Skip to content

Commit 23a592b

Browse files
authored
Don't alert users about fsiExtraParameters if no actual parameters are passed (#1305)
1 parent e0bbe10 commit 23a592b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ open FsAutoComplete.FCSPatches
4343
open Helpers
4444
open System.Runtime.ExceptionServices
4545

46+
module ArrayHelpers =
47+
let (|EmptyArray|NonEmptyArray|) (a: 'a array) = if a.Length = 0 then EmptyArray else NonEmptyArray a
48+
49+
open ArrayHelpers
50+
4651
type AdaptiveFSharpLspServer
4752
(
4853
workspaceLoader: IWorkspaceLoader,
@@ -295,15 +300,15 @@ type AdaptiveFSharpLspServer
295300
match dto.FSIExtraParameters, dto.FSIExtraInteractiveParameters, dto.FSIExtraSharedParameters with
296301
// old-style, silent success; start warning when we plan to
297302
// deprecate
298-
| Some p, None, None ->
303+
| Some(NonEmptyArray p), (None | Some EmptyArray), (None | Some EmptyArray) ->
299304
let c =
300305
{ dto with
301306
FSIExtraSharedParameters = Some p }
302307

303308
None, c
304309
// mix old and new, warn and mimic old behavior
305-
| Some p, Some _, _
306-
| Some p, _, Some _ ->
310+
| Some(NonEmptyArray p), Some(NonEmptyArray _), _
311+
| Some(NonEmptyArray p), _, Some(NonEmptyArray _) ->
307312
let m: ShowMessageParams =
308313
{ Type = MessageType.Warning
309314
Message =
@@ -315,6 +320,7 @@ type AdaptiveFSharpLspServer
315320

316321
Some m, c
317322
// no old parameter, proceed happily
323+
| Some EmptyArray, _, _ -> None, dto
318324
| None, _, _ -> None, dto
319325

320326
interface IFSharpLspServer with

0 commit comments

Comments
 (0)