diff --git a/src/FsAutoComplete/LspHelpers.fs b/src/FsAutoComplete/LspHelpers.fs index b8e147f2b..ba1861ceb 100644 --- a/src/FsAutoComplete/LspHelpers.fs +++ b/src/FsAutoComplete/LspHelpers.fs @@ -605,7 +605,7 @@ type NotificationsDto = TraceNamespaces: string array option } type BuildOptionsDto = - { MsBuildProperties: string array option } + { MsBuildProperties: Dictionary option } type DebugDto = { DontCheckRelatedFiles: bool option @@ -700,16 +700,24 @@ type NotificationsConfig = TraceNamespaces = defaultArg dto.TraceNamespaces this.TraceNamespaces } type BuildOptions = - { MsBuildProperties: string array } + { MsBuildProperties: Map } - static member Default = { MsBuildProperties = [||] } + static member Default = { MsBuildProperties = Map.empty } static member FromDto(dto: BuildOptionsDto) : BuildOptions = - { MsBuildProperties = defaultArg dto.MsBuildProperties BuildOptions.Default.MsBuildProperties } + let props = + dto.MsBuildProperties + |> Option.map ( Seq.map (|KeyValue|) >> Map.ofSeq) + + { MsBuildProperties = defaultArg props BuildOptions.Default.MsBuildProperties } member this.AddDto(dto: BuildOptionsDto) : BuildOptions = - { MsBuildProperties = defaultArg dto.MsBuildProperties this.MsBuildProperties } + let props = + dto.MsBuildProperties + |> Option.map ( Seq.map (|KeyValue|) >> Map.ofSeq) + + { MsBuildProperties = defaultArg props this.MsBuildProperties } type DebugConfig = { DontCheckRelatedFiles: bool diff --git a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs index c8b78b2ca..300042f1d 100644 --- a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs +++ b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs @@ -636,16 +636,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: Map -> IWorkspaceL let! loaderFactory = loaderFactory and! config = config - let props = - config.BuildOptions.MsBuildProperties - |> Array.choose(fun s -> - match s.Split("=") |> Array.toList with - | head::shoulders::_ -> Some(head,shoulders) - | _ -> None - ) - |> Map.ofArray - - return loaderFactory props + return loaderFactory config.BuildOptions.MsBuildProperties }