Skip to content

Commit 6ad1ca3

Browse files
committed
Using simple dictionary for msbuild props
1 parent 05be364 commit 6ad1ca3

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
@@ -605,7 +605,7 @@ type NotificationsDto =
605605
TraceNamespaces: string array option }
606606

607607
type BuildOptionsDto =
608-
{ MsBuildProperties: string array option }
608+
{ MsBuildProperties: Dictionary<string,string> option }
609609

610610
type DebugDto =
611611
{ DontCheckRelatedFiles: bool option
@@ -700,16 +700,24 @@ type NotificationsConfig =
700700
TraceNamespaces = defaultArg dto.TraceNamespaces this.TraceNamespaces }
701701

702702
type BuildOptions =
703-
{ MsBuildProperties: string array }
703+
{ MsBuildProperties: Map<string, string> }
704704

705-
static member Default = { MsBuildProperties = [||] }
705+
static member Default = { MsBuildProperties = Map.empty }
706706

707707
static member FromDto(dto: BuildOptionsDto) : BuildOptions =
708-
{ MsBuildProperties = defaultArg dto.MsBuildProperties BuildOptions.Default.MsBuildProperties }
708+
let props =
709+
dto.MsBuildProperties
710+
|> Option.map ( Seq.map (|KeyValue|) >> Map.ofSeq)
711+
712+
{ MsBuildProperties = defaultArg props BuildOptions.Default.MsBuildProperties }
709713

710714

711715
member this.AddDto(dto: BuildOptionsDto) : BuildOptions =
712-
{ MsBuildProperties = defaultArg dto.MsBuildProperties this.MsBuildProperties }
716+
let props =
717+
dto.MsBuildProperties
718+
|> Option.map ( Seq.map (|KeyValue|) >> Map.ofSeq)
719+
720+
{ MsBuildProperties = defaultArg props this.MsBuildProperties }
713721

714722
type DebugConfig =
715723
{ DontCheckRelatedFiles: bool

src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs

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

639-
let props =
640-
config.BuildOptions.MsBuildProperties
641-
|> Array.choose(fun s ->
642-
match s.Split("=") |> Array.toList with
643-
| head::shoulders::_ -> Some(head,shoulders)
644-
| _ -> None
645-
)
646-
|> Map.ofArray
647-
648-
return loaderFactory props
639+
return loaderFactory config.BuildOptions.MsBuildProperties
649640
}
650641

651642

0 commit comments

Comments
 (0)