diff --git a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs index c608fc4e3..de0a5843b 100644 --- a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs +++ b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs @@ -870,9 +870,15 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar }) let getProjectOptionsForFile (filePath: string) = - openFilesToChangesAndProjectOptions - |> AMap.tryFindA filePath - |> AVal.map (Option.map snd >> Option.defaultValue []) + aval { + match! sourceFileToProjectOptions |> AMap.tryFind filePath with + | None -> + // openFilesToChangesAndProjectOptions contains script files that we may need to look through + match! openFilesToChangesAndProjectOptions |> AMap.tryFindA filePath with + | None -> return [] + | Some (_, projs) -> return projs + | Some projs -> return projs + } let autoCompleteItems: cmap * (Position -> option) * FSharp.Compiler.Syntax.ParsedInput> = cmap ()