1
1
namespace Ionide.LanguageServerProtocol
2
2
3
3
open Ionide.LanguageServerProtocol .Types
4
+ open Ionide.LanguageServerProtocol .JsonRpc
4
5
5
6
module private ClientUtil =
6
7
/// Return the JSON-RPC "not implemented" error
@@ -11,131 +12,6 @@ module private ClientUtil =
11
12
12
13
open ClientUtil
13
14
14
- [<Interface>]
15
- type ILspClient =
16
- /// The show message notification is sent from a server to a client to ask the client to display
17
- /// a particular message in the user interface.
18
- abstract member WindowShowMessage: ShowMessageParams -> Async < unit >
19
-
20
- /// The show message request is sent from a server to a client to ask the client to display
21
- /// a particular message in the user interface. In addition to the show message notification the
22
- /// request allows to pass actions and to wait for an answer from the client.
23
- abstract member WindowShowMessageRequest: ShowMessageRequestParams -> AsyncLspResult < MessageActionItem option >
24
-
25
-
26
- /// The log message notification is sent from the server to the client to ask the client to log
27
- ///a particular message.
28
- abstract member WindowLogMessage: LogMessageParams -> Async < unit >
29
-
30
- /// The show document request is sent from a server to a client to ask the client to display a particular
31
- /// resource referenced by a URI in the user interface.
32
- abstract member WindowShowDocument: ShowDocumentParams -> AsyncLspResult < ShowDocumentResult >
33
-
34
- /// The telemetry notification is sent from the server to the client to ask the client to log
35
- /// a telemetry event.
36
- abstract member TelemetryEvent: Newtonsoft.Json.Linq.JToken -> Async < unit >
37
-
38
- /// The `client/registerCapability` request is sent from the server to the client to register for a new
39
- /// capability on the client side. Not all clients need to support dynamic capability registration.
40
- /// A client opts in via the dynamicRegistration property on the specific client capabilities. A client
41
- /// can even provide dynamic registration for capability A but not for capability B.
42
- abstract member ClientRegisterCapability: RegistrationParams -> AsyncLspResult < unit >
43
-
44
- /// The `client/unregisterCapability` request is sent from the server to the client to unregister a previously
45
- /// registered capability.
46
- abstract member ClientUnregisterCapability: UnregistrationParams -> AsyncLspResult < unit >
47
-
48
-
49
- /// Many tools support more than one root folder per workspace. Examples for this are VS Code’s multi-root
50
- /// support, Atom’s project folder support or Sublime’s project support. If a client workspace consists of
51
- /// multiple roots then a server typically needs to know about this. The protocol up to know assumes one root
52
- /// folder which is announce to the server by the rootUri property of the InitializeParams.
53
- /// If the client supports workspace folders and announces them via the corresponding workspaceFolders client
54
- /// capability the InitializeParams contain an additional property workspaceFolders with the configured
55
- /// workspace folders when the server starts.
56
- ///
57
- /// The workspace/workspaceFolders request is sent from the server to the client to fetch the current open
58
- /// list of workspace folders. Returns null in the response if only a single file is open in the tool.
59
- /// Returns an empty array if a workspace is open but no folders are configured.
60
- abstract member WorkspaceWorkspaceFolders: unit -> AsyncLspResult < WorkspaceFolder [] option >
61
-
62
- /// The workspace/configuration request is sent from the server to the client to fetch configuration
63
- /// settings from the client.
64
- ///
65
- /// The request can fetch n configuration settings in one roundtrip. The order of the returned configuration
66
- /// settings correspond to the order of the passed ConfigurationItems (e.g. the first item in the response
67
- /// is the result for the first configuration item in the params).
68
- abstract member WorkspaceConfiguration: ConfigurationParams -> AsyncLspResult < Newtonsoft.Json.Linq.JToken []>
69
-
70
-
71
- abstract member WorkspaceApplyEdit: ApplyWorkspaceEditParams -> AsyncLspResult < ApplyWorkspaceEditResult >
72
-
73
- /// The workspace/semanticTokens/refresh request is sent from the server to the client.
74
- /// Servers can use it to ask clients to refresh the editors for which this server provides semantic tokens.
75
- /// As a result the client should ask the server to recompute the semantic tokens for these editors.
76
- /// This is useful if a server detects a project wide configuration change which requires a re-calculation
77
- /// of all semantic tokens. Note that the client still has the freedom to delay the re-calculation of
78
- /// the semantic tokens if for example an editor is currently not visible.
79
- abstract member WorkspaceSemanticTokensRefresh: unit -> Async < unit >
80
-
81
-
82
- /// The `workspace/inlayHint/refresh` request is sent from the server to the client.
83
- /// Servers can use it to ask clients to refresh the inlay hints currently shown in editors.
84
- /// As a result the client should ask the server to recompute the inlay hints for these editors.
85
- /// This is useful if a server detects a configuration change which requires a re-calculation
86
- /// of all inlay hints. Note that the client still has the freedom to delay the re-calculation of the inlay hints
87
- /// if for example an editor is currently not visible.
88
- abstract member WorkspaceInlayHintRefresh: unit -> Async < unit >
89
-
90
-
91
- /// The workspace/codeLens/refresh request is sent from the server to the client. Servers can use it to ask
92
- /// clients to refresh the code lenses currently shown in editors. As a result the client should ask the
93
- /// server to recompute the code lenses for these editors. This is useful if a server detects a
94
- /// configuration change which requires a re-calculation of all code lenses. Note that the client still has
95
- /// the freedom to delay the re-calculation of the code lenses if for example an editor is currently not
96
- /// visible.
97
- abstract member WorkspaceCodeLensRefresh: unit -> Async < unit >
98
-
99
-
100
- /// The workspace/inlineValue/refresh request is sent from the server to the client. Servers can use it to
101
- /// ask clients to refresh the inline values currently shown in editors. As a result the client should ask
102
- /// the server to recompute the inline values for these editors. This is useful if a server detects a
103
- /// configuration change which requires a re-calculation of all inline values. Note that the client still
104
- /// has the freedom to delay the re-calculation of the inline values if for example an editor is currently
105
- /// not visible.
106
- abstract member WorkspaceInlineValueRefresh: unit -> Async < unit >
107
-
108
-
109
- /// Diagnostics notification are sent from the server to the client to signal results of validation runs.
110
- ///
111
- /// Diagnostics are “owned” by the server so it is the server’s responsibility to clear them if necessary.
112
- /// The following rule is used for VS Code servers that generate diagnostics:
113
- ///
114
- /// * if a language is single file only (for example HTML) then diagnostics are cleared by the server when
115
- /// the file is closed.
116
- /// * if a language has a project system (for example C#) diagnostics are not cleared when a file closes.
117
- /// When a project is opened all diagnostics for all files are recomputed (or read from a cache).
118
- ///
119
- /// When a file changes it is the server’s responsibility to re-compute diagnostics and push them to the
120
- /// client. If the computed set is empty it has to push the empty array to clear former diagnostics.
121
- /// Newly pushed diagnostics always replace previously pushed diagnostics. There is no merging that happens
122
- /// on the client side.
123
- abstract member TextDocumentPublishDiagnostics: PublishDiagnosticsParams -> Async < unit >
124
-
125
- /// The workspace/diagnostic/refresh request is sent from the server to the client. Servers can use it to
126
- /// ask clients to refresh all needed document and workspace diagnostics. This is useful if a server detects
127
- /// a project wide configuration change which requires a re-calculation of all diagnostics.
128
- abstract member WorkspaceDiagnosticRefresh: unit -> Async < unit >
129
-
130
- /// The window/workDoneProgress/create request is sent from the server to the client to ask the client to create a work done progress.
131
- abstract member WorkDoneProgressCreate: ProgressToken -> AsyncLspResult < unit >
132
-
133
- /// The base protocol offers also support to report progress in a generic fashion.
134
- /// This mechanism can be used to report any kind of progress including work done progress
135
- /// (usually used to report progress in the user interface using a progress bar) and
136
- /// partial result progress to support streaming of results.
137
- abstract member Progress: ProgressToken * 'Progress -> Async < unit >
138
-
139
15
[<AbstractClass>]
140
16
type LspClient () =
141
17
@@ -218,39 +94,39 @@ type LspClient() =
218
94
/// This is useful if a server detects a project wide configuration change which requires a re-calculation
219
95
/// of all semantic tokens. Note that the client still has the freedom to delay the re-calculation of
220
96
/// the semantic tokens if for example an editor is currently not visible.
221
- abstract member WorkspaceSemanticTokensRefresh: unit -> Async < unit >
97
+ abstract member WorkspaceSemanticTokensRefresh: unit -> AsyncLspResult < unit >
222
98
223
- default __.WorkspaceSemanticTokensRefresh () = ignoreNotification
99
+ default __.WorkspaceSemanticTokensRefresh () = notImplemented
224
100
225
101
/// The `workspace/inlayHint/refresh` request is sent from the server to the client.
226
102
/// Servers can use it to ask clients to refresh the inlay hints currently shown in editors.
227
103
/// As a result the client should ask the server to recompute the inlay hints for these editors.
228
104
/// This is useful if a server detects a configuration change which requires a re-calculation
229
105
/// of all inlay hints. Note that the client still has the freedom to delay the re-calculation of the inlay hints
230
106
/// if for example an editor is currently not visible.
231
- abstract member WorkspaceInlayHintRefresh: unit -> Async < unit >
107
+ abstract member WorkspaceInlayHintRefresh: unit -> AsyncLspResult < unit >
232
108
233
- default __.WorkspaceInlayHintRefresh () = ignoreNotification
109
+ default __.WorkspaceInlayHintRefresh () = notImplemented
234
110
235
111
/// The workspace/codeLens/refresh request is sent from the server to the client. Servers can use it to ask
236
112
/// clients to refresh the code lenses currently shown in editors. As a result the client should ask the
237
113
/// server to recompute the code lenses for these editors. This is useful if a server detects a
238
114
/// configuration change which requires a re-calculation of all code lenses. Note that the client still has
239
115
/// the freedom to delay the re-calculation of the code lenses if for example an editor is currently not
240
116
/// visible.
241
- abstract member WorkspaceCodeLensRefresh: unit -> Async < unit >
117
+ abstract member WorkspaceCodeLensRefresh: unit -> AsyncLspResult < unit >
242
118
243
- default __.WorkspaceCodeLensRefresh () = ignoreNotification
119
+ default __.WorkspaceCodeLensRefresh () = notImplemented
244
120
245
121
/// The workspace/inlineValue/refresh request is sent from the server to the client. Servers can use it to
246
122
/// ask clients to refresh the inline values currently shown in editors. As a result the client should ask
247
123
/// the server to recompute the inline values for these editors. This is useful if a server detects a
248
124
/// configuration change which requires a re-calculation of all inline values. Note that the client still
249
125
/// has the freedom to delay the re-calculation of the inline values if for example an editor is currently
250
126
/// not visible.
251
- abstract member WorkspaceInlineValueRefresh: unit -> Async < unit >
127
+ abstract member WorkspaceInlineValueRefresh: unit -> AsyncLspResult < unit >
252
128
253
- default __.WorkspaceInlineValueRefresh () = ignoreNotification
129
+ default __.WorkspaceInlineValueRefresh () = notImplemented
254
130
255
131
/// Diagnostics notification are sent from the server to the client to signal results of validation runs.
256
132
///
@@ -273,17 +149,23 @@ type LspClient() =
273
149
/// The workspace/diagnostic/refresh request is sent from the server to the client. Servers can use it to
274
150
/// ask clients to refresh all needed document and workspace diagnostics. This is useful if a server detects
275
151
/// a project wide configuration change which requires a re-calculation of all diagnostics.
276
- abstract member WorkspaceDiagnosticRefresh: unit -> Async < unit >
152
+ abstract member WorkspaceDiagnosticRefresh: unit -> AsyncLspResult < unit >
153
+
154
+ default __.WorkspaceDiagnosticRefresh () = notImplemented
155
+
156
+ abstract member Progress: ProgressParams -> Async < unit >
277
157
278
- default __.WorkspaceDiagnosticRefresh ( ) = ignoreNotification
158
+ default __.Progress ( p ) = ignoreNotification
279
159
280
- abstract member Progress: ProgressToken * 'Progress -> Async < unit >
160
+ abstract member CancelRequest: CancelParams -> Async < unit >
161
+ default __.CancelRequest ( _ ) = ignoreNotification
281
162
282
- default __.Progress ( _ , _ ) = ignoreNotification
163
+ abstract member LogTrace: LogTraceParams -> Async < unit >
164
+ default __.LogTrace ( _ ) = ignoreNotification
283
165
284
166
/// The window/workDoneProgress/create request is sent from the server to the client to ask the client to create a work done progress.
285
- abstract member WorkDoneProgressCreate: ProgressToken -> AsyncLspResult < unit >
286
- default __.WorkDoneProgressCreate ( _ ) = notImplemented
167
+ abstract member WindowWorkDoneProgressCreate: WorkDoneProgressCreateParams -> AsyncLspResult < unit >
168
+ default __.WindowWorkDoneProgressCreate ( _ ) = notImplemented
287
169
288
170
interface ILspClient with
289
171
member this.WindowShowMessage ( p : ShowMessageParams ) = this.WindowShowMessage( p)
@@ -302,5 +184,8 @@ type LspClient() =
302
184
member this.WorkspaceInlineValueRefresh () = this.WorkspaceInlineValueRefresh()
303
185
member this.TextDocumentPublishDiagnostics ( p : PublishDiagnosticsParams ) = this.TextDocumentPublishDiagnostics( p)
304
186
member this.WorkspaceDiagnosticRefresh () = this.WorkspaceDiagnosticRefresh()
305
- member this.WorkDoneProgressCreate ( token : ProgressToken ) = this.WorkDoneProgressCreate( token)
306
- member this.Progress ( token , data ) = this.Progress( token, data)
187
+ member this.WindowWorkDoneProgressCreate ( p : WorkDoneProgressCreateParams ) = this.WindowWorkDoneProgressCreate( p)
188
+ member this.Progress ( p : ProgressParams ) = this.Progress( p)
189
+ member this.CancelRequest ( p : CancelParams ) : Async < unit > = this.CancelRequest( p)
190
+ member this.LogTrace ( p : LogTraceParams ) : Async < unit > = this.LogTrace( p)
191
+ member this.Dispose () : unit = ()
0 commit comments