-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(language-server): use a config variable to store configuration
changes When using for example the neovim language server client, the contextive language server does not acquire the proper settings sent by the client in the `OnStarted` handler. However, the settings are passed correctly using the `OnDidChangeConfiguration` handler. This change introduces a scoped variable in the server start function to hold a mutable field for the Contextive path configuration. The configuration variable is initialized with the default path for Contextive definitions introduced in commit 23f9049. If the language configuration does not have a config value, it will use the value from the configuration variable instead. This works the same way as it did previously, but the source is now a parameter of the function.
- Loading branch information
1 parent
a098580
commit 7a1d36f
Showing
3 changed files
with
18 additions
and
12 deletions.
There are no files selected for viewing
7 changes: 6 additions & 1 deletion
7
src/language-server/Contextive.LanguageServer/Configuration.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
module Contextive.LanguageServer.Configuration | ||
|
||
open System.Threading.Tasks | ||
open OmniSharp.Extensions.LanguageServer.Protocol.Models | ||
|
||
let resolvedPathGetter configGetter pathResolver () = | ||
async { | ||
let! path = configGetter () | ||
return pathResolver path | ||
} | ||
|
||
let handler (definitionsLoader: Definitions.Reloader) _ = | ||
type Config = { mutable Path: string option } | ||
|
||
let handler (config: Config) (definitionsLoader: Definitions.Reloader) (configParams: DidChangeConfigurationParams) = | ||
let path = configParams.Settings.Item("contextive").Item("path") | ||
config.Path <- Some(path.ToString()) | ||
definitionsLoader () | ||
Task.CompletedTask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters