Skip to content

Commit 249e9b9

Browse files
committed
Using simple dictionary for msbuild props
1 parent 11fcf6e commit 249e9b9

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

src/FsAutoComplete/LspHelpers.fs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ type NotificationsDto =
610610
TraceNamespaces: string array option }
611611

612612
type BuildOptionsDto =
613-
{ MsBuildProperties: string array option }
613+
{ MsBuildProperties: Dictionary<string,string> option }
614614

615615
type DebugDto =
616616
{ DontCheckRelatedFiles: bool option
@@ -730,16 +730,24 @@ type FSACConfig =
730730
member this.AddDto(dto: FSACDto) =
731731
{ CachedTypeCheckCount = defaultArg dto.CachedTypeCheckCount this.CachedTypeCheckCount }
732732
type BuildOptions =
733-
{ MsBuildProperties: string array }
733+
{ MsBuildProperties: Map<string, string> }
734734

735-
static member Default = { MsBuildProperties = [||] }
735+
static member Default = { MsBuildProperties = Map.empty }
736736

737737
static member FromDto(dto: BuildOptionsDto) : BuildOptions =
738-
{ MsBuildProperties = defaultArg dto.MsBuildProperties BuildOptions.Default.MsBuildProperties }
738+
let props =
739+
dto.MsBuildProperties
740+
|> Option.map ( Seq.map (|KeyValue|) >> Map.ofSeq)
741+
742+
{ MsBuildProperties = defaultArg props BuildOptions.Default.MsBuildProperties }
739743

740744

741745
member this.AddDto(dto: BuildOptionsDto) : BuildOptions =
742-
{ MsBuildProperties = defaultArg dto.MsBuildProperties this.MsBuildProperties }
746+
let props =
747+
dto.MsBuildProperties
748+
|> Option.map ( Seq.map (|KeyValue|) >> Map.ofSeq)
749+
750+
{ MsBuildProperties = defaultArg props this.MsBuildProperties }
743751

744752
type DebugConfig =
745753
{ DontCheckRelatedFiles: bool

src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -515,16 +515,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: Map<string, string> -> IWorkspaceL
515515
let! loaderFactory = loaderFactory
516516
and! config = config
517517

518-
let props =
519-
config.BuildOptions.MsBuildProperties
520-
|> Array.choose(fun s ->
521-
match s.Split("=") |> Array.toList with
522-
| head::shoulders::_ -> Some(head,shoulders)
523-
| _ -> None
524-
)
525-
|> Map.ofArray
526-
527-
return loaderFactory props
518+
return loaderFactory config.BuildOptions.MsBuildProperties
528519
}
529520

530521

0 commit comments

Comments
 (0)