-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.fs
More file actions
48 lines (38 loc) · 1.57 KB
/
Client.fs
File metadata and controls
48 lines (38 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
namespace LspExample
open Ionide.LanguageServerProtocol
open Ionide.LanguageServerProtocol.JsonRpc
/// <summary>
/// The Client is not the client process (the IDE host);
/// it is an object that can communicate with the host client by sending it messages.
/// This is in contrast to the Server which can only receive messages from the host client.
/// </summary>
type Client(notificationSender: Server.ClientNotificationSender, requestSender: Server.ClientRequestSender) =
inherit LspClient()
member this.ShowInfo(message) =
this.WindowShowMessage(
{ Type = Types.MessageType.Info
Message = message }
)
member this.ShowError(message) =
this.WindowShowMessage(
{ Type = Types.MessageType.Error
Message = message }
)
member this.LogDebug(message) =
this.WindowLogMessage(
{ Type = Types.MessageType.Debug
Message = message }
)
override this.WindowLogMessage p =
match box p with
| null -> async { }
| value -> notificationSender "window/logMessage" value |> Async.Ignore
override this.WindowShowMessage p =
match box p with
| null -> async { }
| value -> notificationSender "window/showMessage" value |> Async.Ignore
override this.WindowShowMessageRequest p =
match box p with
| null ->
async { return Result.Error(Error.InternalError("Attempted to send message, but the parameter was null")) }
| value -> requestSender.Send "window/showMessageRequest" value