From 6ad1ca35e2f25e17988b0e1df60a801b57d36d44 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Sat, 25 Feb 2023 13:50:26 -0500 Subject: [PATCH] Using simple dictionary for msbuild props --- src/FsAutoComplete/LspHelpers.fs | 18 +++++++++++++----- .../LspServers/AdaptiveFSharpLspServer.fs | 11 +---------- 2 files changed, 14 insertions(+), 15 deletions(-) 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 2acf5693c..aaa5f3d16 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 }