Skip to content

Commit

Permalink
Declarations only required ParseResults (#1150)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd authored Jul 28, 2023
1 parent f97f9de commit 72103b5
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs
Original file line number Diff line number Diff line change
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 =
openFilesToParsedResults
|> 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

0 comments on commit 72103b5

Please sign in to comment.