@@ -18,8 +18,21 @@ open Microsoft.CodeAnalysis
1818open Microsoft.VisualStudio .LanguageServices .Implementation
1919open Microsoft.VisualStudio .LanguageServices .Implementation .ProjectSystem
2020
21- type internal FSharpProjectSite ( hierarchy : IVsHierarchy , serviceProvider : System.IServiceProvider , visualStudioWorkspace : VisualStudioWorkspaceImpl , projectName : string ) =
22- inherit AbstractProject( visualStudioWorkspace.ProjectTracker, null , projectName, hierarchy, FSharpCommonConstants.FSharpLanguageName, serviceProvider, visualStudioWorkspace, null )
21+ type internal FSharpProjectSite ( hierarchy : IVsHierarchy , serviceProvider : System.IServiceProvider , visualStudioWorkspace : VisualStudioWorkspaceImpl , projectName : string , projectGuid : Guid ) =
22+ inherit AbstractProject(
23+ projectTracker = visualStudioWorkspace.ProjectTracker,
24+ reportExternalErrorCreatorOpt = null ,
25+ projectSystemName = projectName,
26+ projectFilePath = projectName,
27+ hierarchy = hierarchy,
28+ language = FSharpCommonConstants.FSharpLanguageName,
29+ projectGuid = projectGuid,
30+ serviceProvider = serviceProvider,
31+ visualStudioWorkspaceOpt = visualStudioWorkspace,
32+ hostDiagnosticUpdateSourceOpt = null ,
33+ commandLineParserServiceOpt = null )
34+
35+ override this.LastDesignTimeBuildSucceeded with get() = false
2336
2437 member internal this.Initialize ( hier : IVsHierarchy , site : IProjectSite ) =
2538 this.ProjectTracker.AddProject( this)
@@ -31,7 +44,7 @@ type internal FSharpProjectSite(hierarchy: IVsHierarchy, serviceProvider: System
3144 new AdviseProjectSiteChanges( fun () -> this.Disconnect()))
3245
3346 // Add files and references
34- for file in site.SourceFilesOnDisk() do this.AddDocument ( hier, file)
47+ for file in site.SourceFilesOnDisk() do this.AddDocumentAux ( hier, file)
3548 for ref in this.GetReferences( site.CompilerFlags()) do this.AddReference( ref)
3649
3750 member this.GetReferences ( flags : string []) =
@@ -43,20 +56,15 @@ type internal FSharpProjectSite(hierarchy: IVsHierarchy, serviceProvider: System
4356 member this.RemoveReference ( filePath : string ) =
4457 this.RemoveMetadataReference( filePath)
4558
46- member internal this.AddDocument ( hier : IVsHierarchy , file : string ) =
47- let itemid =
48- match hier.ParseCanonicalName( file) with
49- | ( VSConstants.S_ OK, id) -> id
50- | _ -> uint32 VSConstants.VSITEMID.Nil
51-
52- let document = this.ProjectTracker.DocumentProvider.TryGetDocumentForFile( this, itemid, file, SourceCodeKind.Regular, fun x -> true )
53- this.AddDocument( document, true )
59+ member internal this.AddDocumentAux ( _ : IVsHierarchy , file : string ) =
60+ let document = this.ProjectTracker.DocumentProvider.TryGetDocumentForFile( this, null , file, SourceCodeKind.Regular, fun x -> true )
61+ this.AddDocument( document, true , true )
5462
5563 member internal this.OnProjectSettingsChanged ( hier : IVsHierarchy , site : IProjectSite ) =
5664 let sourceFiles = site.SourceFilesOnDisk()
5765
5866 // Added files
59- for file in sourceFiles do if not ( this.ContainsFile( file)) then this.AddDocument ( hier, file)
67+ for file in sourceFiles do if not ( this.ContainsFile( file)) then this.AddDocumentAux ( hier, file)
6068 // Removed files
6169 let removedDocuments = this.GetCurrentDocuments() |> Seq.where( fun doc -> not ( sourceFiles |> Seq.contains( doc.FilePath))) |> Seq.toList
6270 for doc in removedDocuments do this.RemoveDocument( doc)
0 commit comments