Skip to content

Commit

Permalink
Using simple dictionary for msbuild props
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Feb 26, 2023
1 parent 05be364 commit 6ad1ca3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
18 changes: 13 additions & 5 deletions src/FsAutoComplete/LspHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ type NotificationsDto =
TraceNamespaces: string array option }

type BuildOptionsDto =
{ MsBuildProperties: string array option }
{ MsBuildProperties: Dictionary<string,string> option }

type DebugDto =
{ DontCheckRelatedFiles: bool option
Expand Down Expand Up @@ -700,16 +700,24 @@ type NotificationsConfig =
TraceNamespaces = defaultArg dto.TraceNamespaces this.TraceNamespaces }

type BuildOptions =
{ MsBuildProperties: string array }
{ MsBuildProperties: Map<string, string> }

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
Expand Down
11 changes: 1 addition & 10 deletions src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -636,16 +636,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: Map<string, string> -> 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
}


Expand Down

0 comments on commit 6ad1ca3

Please sign in to comment.