Skip to content

Commit c58a91a

Browse files
committed
Drop showMessage, use ILspClient.WindowShowMessage directly
1 parent 670000f commit c58a91a

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/CSharpLanguageServer/RoslynHelpers.fs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ type CSharpLspHostServices () =
350350
let tryLoadSolutionOnPath
351351
(lspClient: ILspClient)
352352
(logger: ILog)
353-
(showMessage: string -> Async<unit>)
354353
solutionPath =
355354
let progress = ProgressReporter(lspClient)
356355

@@ -423,7 +422,6 @@ let tryLoadSolutionFromProjectFiles
423422
let findAndLoadSolutionOnDir
424423
(lspClient: ILspClient)
425424
(logger: ILog)
426-
(showMessage: string -> Async<unit>)
427425
dir =
428426
async {
429427
let fileNotOnNodeModules (filename: string) =
@@ -436,6 +434,12 @@ let findAndLoadSolutionOnDir
436434
|> Seq.filter fileNotOnNodeModules
437435
|> Seq.toList
438436

437+
let showMessage m =
438+
lspClient.WindowShowMessage({
439+
Type = MessageType.Info
440+
Message = sprintf "csharp-ls: %s" m
441+
})
442+
439443
do! showMessage (sprintf "%d solution(s) found: [%s]" solutionFiles.Length (String.Join(", ", solutionFiles)) )
440444

441445
let singleSolutionFound =
@@ -464,23 +468,27 @@ let findAndLoadSolutionOnDir
464468
return! tryLoadSolutionFromProjectFiles lspClient logger showMessage projFiles
465469

466470
| Some solutionPath ->
467-
return! tryLoadSolutionOnPath lspClient logger showMessage solutionPath
471+
return! tryLoadSolutionOnPath lspClient logger solutionPath
468472
}
469473

470474
let loadSolutionOnSolutionPathOrDir
471475
(lspClient: ILspClient)
472476
(logger: ILog)
473-
(showMessage: string -> Async<unit>)
474477
solutionPathMaybe
475478
rootPath =
476479
match solutionPathMaybe with
477480
| Some solutionPath -> async {
478-
return! tryLoadSolutionOnPath lspClient logger showMessage solutionPath
481+
return! tryLoadSolutionOnPath lspClient logger solutionPath
479482
}
480483

481484
| None -> async {
482-
do! showMessage (sprintf "attempting to find and load solution based on root path (\"%s\").." rootPath)
483-
return! findAndLoadSolutionOnDir lspClient logger showMessage rootPath
485+
let logMessage: ShowMessageParams = {
486+
Type = MessageType.Info
487+
Message = sprintf "csharp-ls: attempting to find and load solution based on root path (\"%s\").." rootPath
488+
}
489+
490+
do! lspClient.WindowShowMessage(logMessage)
491+
return! findAndLoadSolutionOnDir lspClient logger rootPath
484492
}
485493

486494
let getContainingTypeOrThis (symbol: ISymbol): INamedTypeSymbol =

src/CSharpLanguageServer/State/ServerState.fs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,6 @@ let getDocumentForUriOfType state docType (u: string) =
134134
| None -> None
135135

136136
let processServerEvent (logger: ILog) state postMsg msg : Async<ServerState> = async {
137-
let showMessage m =
138-
match state.LspClient with
139-
| Some lspClient -> lspClient.WindowShowMessage(
140-
{ Type = MessageType.Info
141-
Message = sprintf "csharp-ls: %s" m })
142-
| None -> async.Return ()
143-
144137
match msg with
145138
| SettingsChange newSettings ->
146139
let newState: ServerState = { state with Settings = newSettings }
@@ -272,7 +265,6 @@ let processServerEvent (logger: ILog) state postMsg msg : Async<ServerState> = a
272265
loadSolutionOnSolutionPathOrDir
273266
state.LspClient.Value
274267
logger
275-
showMessage
276268
state.Settings.SolutionPath
277269
state.RootPath
278270

0 commit comments

Comments
 (0)