Skip to content

Commit 43076cc

Browse files
committed
Make background/transparent compiler switchable
1 parent 77aca9a commit 43076cc

18 files changed

+743
-254
lines changed

src/FsAutoComplete.Core/Commands.fs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -731,10 +731,10 @@ module Commands =
731731

732732
let symbolUseWorkspaceAux
733733
(getDeclarationLocation: FSharpSymbolUse * IFSACSourceText -> Async<SymbolDeclarationLocation option>)
734-
(findReferencesForSymbolInFile: (string<LocalPath> * FSharpProjectSnapshot * FSharpSymbol) -> Async<Range seq>)
734+
(findReferencesForSymbolInFile: (string<LocalPath> * CompilerProjectOption * FSharpSymbol) -> Async<Range seq>)
735735
(tryGetFileSource: string<LocalPath> -> Async<ResultOrString<IFSACSourceText>>)
736-
(tryGetProjectOptionsForFsproj: string<LocalPath> -> Async<FSharpProjectSnapshot option>)
737-
(getAllProjectOptions: unit -> Async<FSharpProjectSnapshot seq>)
736+
(tryGetProjectOptionsForFsproj: string<LocalPath> -> Async<CompilerProjectOption option>)
737+
(getAllProjectOptions: unit -> Async<CompilerProjectOption seq>)
738738
(includeDeclarations: bool)
739739
(includeBackticks: bool)
740740
(errorOnFailureToFixRange: bool)
@@ -787,7 +787,7 @@ module Commands =
787787

788788
return (symbol, ranges)
789789
| scope ->
790-
let projectsToCheck: Async<FSharpProjectSnapshot list> =
790+
let projectsToCheck: Async<CompilerProjectOption list> =
791791
async {
792792
match scope with
793793
| Some(SymbolDeclarationLocation.Projects(projects (*isLocalForProject=*) , true)) -> return projects
@@ -798,8 +798,8 @@ module Commands =
798798
yield Async.singleton (Some project)
799799

800800
yield!
801-
project.ReferencedProjects
802-
|> List.map (fun p -> Utils.normalizePath p.OutputFile |> tryGetProjectOptionsForFsproj) ]
801+
project.ReferencedProjectsPath
802+
|> List.map (fun p -> Utils.normalizePath p |> tryGetProjectOptionsForFsproj) ]
803803
|> Async.parallel75
804804

805805

@@ -839,7 +839,7 @@ module Commands =
839839
/// Adds References of `symbol` in `file` to `dict`
840840
///
841841
/// `Error` iff adjusting ranges failed (including cannot get source) and `errorOnFailureToFixRange`. Otherwise always `Ok`
842-
let tryFindReferencesInFile (file: string<LocalPath>, project: FSharpProjectSnapshot) =
842+
let tryFindReferencesInFile (file: string<LocalPath>, project: CompilerProjectOption) =
843843
async {
844844
if dict.ContainsKey file then
845845
return Ok()
@@ -882,15 +882,14 @@ module Commands =
882882

883883
if errorOnFailureToFixRange then Error e else Ok())
884884

885-
let iterProjects (projects: FSharpProjectSnapshot seq) =
885+
let iterProjects (projects: CompilerProjectOption seq) =
886886
// should:
887887
// * check files in parallel
888888
// * stop when error occurs
889889
// -> `Async.Choice`: executes in parallel, returns first `Some`
890890
// -> map `Error` to `Some` for `Async.Choice`, afterwards map `Some` back to `Error`
891891
[ for project in projects do
892-
for file in project.SourceFiles do
893-
let file = Utils.normalizePath file.FileName
892+
for file in project.SourceFilesTagged do
894893

895894
async {
896895
match! tryFindReferencesInFile (file, project) with
@@ -930,10 +929,10 @@ module Commands =
930929
/// -> for "Rename"
931930
let symbolUseWorkspace
932931
(getDeclarationLocation: FSharpSymbolUse * IFSACSourceText -> Async<SymbolDeclarationLocation option>)
933-
(findReferencesForSymbolInFile: (string<LocalPath> * FSharpProjectSnapshot * FSharpSymbol) -> Async<Range seq>)
932+
(findReferencesForSymbolInFile: (string<LocalPath> * CompilerProjectOption * FSharpSymbol) -> Async<Range seq>)
934933
(tryGetFileSource: string<LocalPath> -> Async<ResultOrString<IFSACSourceText>>)
935-
(tryGetProjectOptionsForFsproj: string<LocalPath> -> Async<FSharpProjectSnapshot option>)
936-
(getAllProjectOptions: unit -> Async<FSharpProjectSnapshot seq>)
934+
(tryGetProjectOptionsForFsproj: string<LocalPath> -> Async<CompilerProjectOption option>)
935+
(getAllProjectOptions: unit -> Async<CompilerProjectOption seq>)
937936
(includeDeclarations: bool)
938937
(includeBackticks: bool)
939938
(errorOnFailureToFixRange: bool)

0 commit comments

Comments
 (0)