diff --git a/src/FsAutoComplete/LspHelpers.fs b/src/FsAutoComplete/LspHelpers.fs index 38a00d084..6b10fc1fc 100644 --- a/src/FsAutoComplete/LspHelpers.fs +++ b/src/FsAutoComplete/LspHelpers.fs @@ -663,7 +663,7 @@ type FSharpConfigDto = Notifications: NotificationsDto option Debug: DebugDto option } -type FSharpConfigRequest = { FSharp: FSharpConfigDto } +type FSharpConfigRequest = { FSharp: FSharpConfigDto option } type CodeLensConfig = { Signature: {| Enabled: bool |} diff --git a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs index f295338ef..87301efa6 100644 --- a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs +++ b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs @@ -3410,9 +3410,12 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar ) let dto = p.Settings |> Server.deserialize - let c = config |> AVal.force - let c = c.AddDto dto.FSharp - updateConfig c + + dto.FSharp + |> Option.iter (fun fsharpConfig -> + let c = config |> AVal.force + let c = c.AddDto fsharpConfig + updateConfig c) with e -> trace.SetStatusErrorSafe(e.Message).RecordExceptions(e) |> ignore diff --git a/src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs b/src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs index 0d6fec898..072d46636 100644 --- a/src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs +++ b/src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs @@ -2106,13 +2106,15 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = >> Log.addContextDestructured "parms" dto ) - let c = config.AddDto dto.FSharp - updateConfig c + dto.FSharp + |> Option.iter (fun fsharpConfig -> + let c = config.AddDto fsharpConfig + updateConfig c - logger.info ( - Log.setMessage "Workspace configuration changed" - >> Log.addContextDestructured "config" c - ) + logger.info ( + Log.setMessage "Workspace configuration changed" + >> Log.addContextDestructured "config" c + )) return () } diff --git a/test/FsAutoComplete.Tests.Lsp/ScriptTests.fs b/test/FsAutoComplete.Tests.Lsp/ScriptTests.fs index d64929744..4acf66afc 100644 --- a/test/FsAutoComplete.Tests.Lsp/ScriptTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/ScriptTests.fs @@ -75,7 +75,7 @@ let scriptEvictionTests state = let configChange: DidChangeConfigurationParams = let config: FSharpConfigRequest = - { FSharp = { defaultConfigDto with FSIExtraParameters = Some [| "--nowarn:760" |] } } + { FSharp = Some { defaultConfigDto with FSIExtraParameters = Some [| "--nowarn:760" |] } } { Settings = Server.serialize config }