Skip to content

Commit

Permalink
autoOpenTests cache server
Browse files Browse the repository at this point in the history
  • Loading branch information
MrLuje committed May 24, 2024
1 parent 58313e2 commit fc5f006
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/FsAutoComplete.Tests.Lsp/CompletionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -722,24 +722,28 @@ let autocompleteTest state =
[ testList "Autocomplete within project files" (makeAutocompleteTestList server)
testList "Autocomplete within script files" (makeAutocompleteTestList scriptServer) ]

///TODO: these are broken in FCS 43.7.200 - something in the tokenization isn't searching the System namespace
let autoOpenTests state =
let dirPath =
Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "CompletionAutoOpenTests")

let serverFor (scriptPath: string) =
let autoOpenServer =
async {
// Auto Open requires unopened things in completions -> External
let config =
{ defaultConfigDto with
ExternalAutocomplete = Some true
ResolveNamespaces = Some true }

let dirPath = Path.GetDirectoryName scriptPath
let scriptName = Path.GetFileName scriptPath
let! (server, events) = serverInitialize dirPath config state
do! waitForWorkspaceFinishedParsing events
return (server, events)
}
|> Async.Cache

let serverFor (scriptPath: string) =
async {
let! (server, events) = autoOpenServer
let scriptName = Path.GetFileName scriptPath
let tdop: DidOpenTextDocumentParams = { TextDocument = loadDocument scriptPath }
do! server.TextDocumentDidOpen tdop

Expand Down

0 comments on commit fc5f006

Please sign in to comment.