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

Add command to restart language service #1942

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions release/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@
"light": "./images/lock-open-solid-light.svg"
},
"title": "Unlock Info Panel"
},
{
"category": "F#",
"command": "fsharp.restartLanguageService",
"title": "Restart Language Service"
}
],
"configuration": {
Expand Down Expand Up @@ -1231,6 +1236,10 @@
{
"command": "fsharp.showDocumentation",
"when": "false"
},
{
"command": "fsharp.restartLanguageService",
"when": "editorLangId == \u0027fsharp\u0027"
}
],
"editor/context": [
Expand Down
11 changes: 11 additions & 0 deletions src/Core/LanguageService.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,3 +1004,14 @@ Consider:
| Some cl -> return! cl.stop ()
| None -> return ()
}

let activate (context: ExtensionContext) =
let restart () =
promise {
logger.Debug("Restarting F# langugae service")
do! stop ()
do! start context
}
sheridanchris marked this conversation as resolved.
Show resolved Hide resolved

commands.registerCommand ("fsharp.restartLanguageService", restart |> objfy2)
|> context.Subscribe
1 change: 1 addition & 0 deletions src/fsharp.fs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ let activate (context: ExtensionContext) : JS.Promise<Api> =
tryActivate "pipelinehints" PipelineHints.Instance.activate context
tryActivate "testExplorer" TestExplorer.activate context
tryActivate "inlayhints" InlayHints.activate context
tryActivate "languageservice" LanguageService.activate context

let buildProject project =
promise {
Expand Down