@@ -325,6 +325,11 @@ type internal TransparentCompiler
325325 useSyntaxTreeCache
326326 ) as self =
327327
328+ let documentSource =
329+ match getSource with
330+ | Some getSource -> DocumentSource.Custom getSource
331+ | None -> DocumentSource.FileSystem
332+
328333 // Is having just one of these ok?
329334 let lexResourceManager = Lexhelp.LexResourceManager()
330335
@@ -1474,8 +1479,6 @@ type internal TransparentCompiler
14741479 let tcSymbolUses = sink.GetSymbolUses()
14751480 let tcOpenDeclarations = sink.GetOpenDeclarations()
14761481
1477- let tcDependencyFiles = [] // TODO add as a set to TcIntermediate
1478-
14791482 // TODO: Apparently creating diagnostics can produce further diagnostics. So let's capture those too. Hopefully there is a more elegant solution...
14801483 // Probably diagnostics need to be evaluated during typecheck anyway for proper formatting, which might take care of this too.
14811484 let extraLogger = CapturingDiagnosticsLogger( " DiagnosticsWhileCreatingDiagnostics" )
@@ -1535,7 +1538,7 @@ type internal TransparentCompiler
15351538 projectSnapshot.IsIncompleteTypeCheckEnvironment,
15361539 None,
15371540 projectSnapshot.ToOptions(),
1538- Array.ofList tcDependencyFiles,
1541+ Array.ofList tcInfo. tcDependencyFiles,
15391542 creationDiags,
15401543 parseResults.Diagnostics,
15411544 tcDiagnostics,
@@ -1934,7 +1937,7 @@ type internal TransparentCompiler
19341937 ) : NodeCode < FSharpCheckFileAnswer > =
19351938 node {
19361939 let! snapshot =
1937- FSharpProjectSnapshot.FromOptions( options, fileName, fileVersion, sourceText)
1940+ FSharpProjectSnapshot.FromOptions( options, fileName, fileVersion, sourceText, documentSource )
19381941 |> NodeCode.AwaitAsync
19391942
19401943 ignore parseResults
@@ -1955,7 +1958,7 @@ type internal TransparentCompiler
19551958 ) : NodeCode < FSharpCheckFileAnswer option > =
19561959 node {
19571960 let! snapshot =
1958- FSharpProjectSnapshot.FromOptions( options, fileName, fileVersion, sourceText)
1961+ FSharpProjectSnapshot.FromOptions( options, fileName, fileVersion, sourceText, documentSource )
19591962 |> NodeCode.AwaitAsync
19601963
19611964 ignore parseResults
@@ -2007,7 +2010,10 @@ type internal TransparentCompiler
20072010 ) : NodeCode < seq < range >> =
20082011 node {
20092012 ignore canInvalidateProject
2010- let! snapshot = FSharpProjectSnapshot.FromOptions options |> NodeCode.AwaitAsync
2013+
2014+ let! snapshot =
2015+ FSharpProjectSnapshot.FromOptions( options, documentSource)
2016+ |> NodeCode.AwaitAsync
20112017
20122018 return ! this.FindReferencesInFile( fileName, snapshot.ProjectSnapshot, symbol, userOpName)
20132019 }
@@ -2020,7 +2026,10 @@ type internal TransparentCompiler
20202026
20212027 member this.GetAssemblyData ( options : FSharpProjectOptions , fileName , userOpName : string ) : NodeCode < ProjectAssemblyDataResult > =
20222028 node {
2023- let! snapshot = FSharpProjectSnapshot.FromOptions options |> NodeCode.AwaitAsync
2029+ let! snapshot =
2030+ FSharpProjectSnapshot.FromOptions( options, documentSource)
2031+ |> NodeCode.AwaitAsync
2032+
20242033 return ! this.GetAssemblyData( snapshot.ProjectSnapshot, fileName, userOpName)
20252034 }
20262035
@@ -2039,7 +2048,9 @@ type internal TransparentCompiler
20392048 userOpName : string
20402049 ) : NodeCode < FSharpParseFileResults * FSharpCheckFileResults > =
20412050 node {
2042- let! snapshot = FSharpProjectSnapshot.FromOptions options |> NodeCode.AwaitAsync
2051+ let! snapshot =
2052+ FSharpProjectSnapshot.FromOptions( options, documentSource)
2053+ |> NodeCode.AwaitAsync
20432054
20442055 match ! this.ParseAndCheckFileInProject( fileName, snapshot.ProjectSnapshot, userOpName) with
20452056 | parseResult, FSharpCheckFileAnswer.Succeeded checkResult -> return parseResult, checkResult
@@ -2053,7 +2064,10 @@ type internal TransparentCompiler
20532064 userOpName : string
20542065 ) : NodeCode < FSharpParseFileResults > =
20552066 node {
2056- let! snapshot = FSharpProjectSnapshot.FromOptions options |> NodeCode.AwaitAsync
2067+ let! snapshot =
2068+ FSharpProjectSnapshot.FromOptions( options, documentSource)
2069+ |> NodeCode.AwaitAsync
2070+
20572071 return ! this.ParseFile( fileName, snapshot.ProjectSnapshot, userOpName)
20582072 }
20592073
@@ -2068,7 +2082,7 @@ type internal TransparentCompiler
20682082 ignore builder
20692083
20702084 let! snapshot =
2071- FSharpProjectSnapshot.FromOptions( options, fileName, 1 , sourceText)
2085+ FSharpProjectSnapshot.FromOptions( options, fileName, 1 , sourceText, documentSource )
20722086 |> NodeCode.AwaitAsync
20732087
20742088 match ! this.ParseAndCheckFileInProject( fileName, snapshot.ProjectSnapshot, " GetCachedCheckFileResult" ) with
@@ -2118,7 +2132,11 @@ type internal TransparentCompiler
21182132 ) : NodeCode < EditorServices.SemanticClassificationView option > =
21192133 node {
21202134 ignore userOpName
2121- let! snapshot = FSharpProjectSnapshot.FromOptions options |> NodeCode.AwaitAsync
2135+
2136+ let! snapshot =
2137+ FSharpProjectSnapshot.FromOptions( options, documentSource)
2138+ |> NodeCode.AwaitAsync
2139+
21222140 return ! ComputeSemanticClassification( fileName, snapshot.ProjectSnapshot)
21232141 }
21242142
@@ -2141,7 +2159,7 @@ type internal TransparentCompiler
21412159 ) : NodeCode < FSharpParseFileResults * FSharpCheckFileAnswer > =
21422160 node {
21432161 let! snapshot =
2144- FSharpProjectSnapshot.FromOptions( options, fileName, fileVersion, sourceText)
2162+ FSharpProjectSnapshot.FromOptions( options, fileName, fileVersion, sourceText, documentSource )
21452163 |> NodeCode.AwaitAsync
21462164
21472165 return ! this.ParseAndCheckFileInProject( fileName, snapshot.ProjectSnapshot, userOpName)
@@ -2153,7 +2171,11 @@ type internal TransparentCompiler
21532171 member this.ParseAndCheckProject ( options : FSharpProjectOptions , userOpName : string ) : NodeCode < FSharpCheckProjectResults > =
21542172 node {
21552173 ignore userOpName
2156- let! snapshot = FSharpProjectSnapshot.FromOptions options |> NodeCode.AwaitAsync
2174+
2175+ let! snapshot =
2176+ FSharpProjectSnapshot.FromOptions( options, documentSource)
2177+ |> NodeCode.AwaitAsync
2178+
21572179 return ! ComputeParseAndCheckProject snapshot.ProjectSnapshot
21582180 }
21592181
0 commit comments