Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declarations only required ParseResults #1150

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs
Expand Up @@ -1453,16 +1453,14 @@ type AdaptiveFSharpLspServer
|> AsyncAVal.forceAsync


let openFilesToCheckedDeclarations =
openFilesToCheckedFilesResults
|> AMap.map (fun k v ->
v
|> AsyncAVal.mapOption (fun c _ -> c.GetParseResults.GetNavigationItems().Declarations))
let openFilesToDeclarations =
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renames to compensate

openFilesToParsedResults
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The real change

|> AMap.map (fun k v -> v |> AsyncAVal.mapOption (fun p _ -> p.GetNavigationItems().Declarations))

let getAllDeclarations () =
let getAllOpenDeclarations () =
async {
let! results =
openFilesToCheckedDeclarations
openFilesToDeclarations
|> AMap.force
|> HashMap.toArray
|> Array.map (fun (k, v) ->
Expand All @@ -1477,7 +1475,7 @@ type AdaptiveFSharpLspServer
}

let getDeclarations filename =
openFilesToCheckedDeclarations |> AMapAsync.tryFindAndFlatten filename
openFilesToDeclarations |> AMapAsync.tryFindAndFlatten filename

let getFilePathAndPosition (p: ITextDocumentPositionParams) =
let filePath = p.GetFilePath() |> Utils.normalizePath
Expand Down Expand Up @@ -3198,7 +3196,7 @@ type AdaptiveFSharpLspServer

let glyphToSymbolKind = glyphToSymbolKind |> AVal.force

let! decls = getAllDeclarations ()
let! decls = getAllOpenDeclarations ()

let res =
decls
Expand Down