osmium_libs_lsp_server_wrapper/lib.rs
1mod client;
2mod jsonrpc;
3mod server;
4mod service;
5
6pub use crate::jsonrpc::{Error, Result};
7pub use client::Client;
8pub use lsp_types;
9use lsp_types::request::{
10 GotoDeclarationParams, GotoDeclarationResponse, GotoImplementationParams,
11 GotoImplementationResponse, GotoTypeDefinitionParams, GotoTypeDefinitionResponse,
12};
13use lsp_types::*;
14use serde_json::Value;
15pub use server::LspStdioServer;
16pub use service::LspService;
17
18/// Trait implemented by language server backends.
19///
20/// This interface allows servers adhering to the [Language Server Protocol] to be implemented in a
21/// safe and easily testable way without exposing the low-level implementation details.
22///
23/// [Language Server Protocol]: https://microsoft.github.io/language-server-protocol/
24pub trait LanguageServer {
25 /// The [`initialize`] request is the first request sent from the client to the server.
26 ///
27 /// [`initialize`]: https://microsoft.github.io/language-server-protocol/specification#initialize
28 ///
29 /// This method is guaranteed to only execute once. If the client sends this request to the
30 /// server again, the server will respond with JSON-RPC error code `-32600` (invalid request).
31 fn initialize(&self, params: InitializeParams) -> Result<InitializeResult>;
32
33 /// The [`initialized`] notification is sent from the client to the server after the client
34 /// received the result of the initialize request but before the client sends anything else.
35 ///
36 /// [`initialized`]: https://microsoft.github.io/language-server-protocol/specification#initialized
37 ///
38 /// The server can use the `initialized` notification, for example, to dynamically register
39 /// capabilities with the client.
40 fn initialized(&self, params: InitializedParams) {
41 let _ = params;
42 }
43
44 /// The [`shutdown`] request asks the server to gracefully shut down, but to not exit.
45 ///
46 /// [`shutdown`]: https://microsoft.github.io/language-server-protocol/specification#shutdown
47 ///
48 /// This request is often later followed by an [`exit`] notification, which will cause the
49 /// server to exit immediately.
50 ///
51 /// [`exit`]: https://microsoft.github.io/language-server-protocol/specification#exit
52 ///
53 /// This method is guaranteed to only execute once. If the client sends this request to the
54 /// server again, the server will respond with JSON-RPC error code `-32600` (invalid request).
55 fn shutdown(&self) -> Result<()>;
56
57 // Document Synchronization
58
59 /// The [`textDocument/didOpen`] notification is sent from the client to the server to signal
60 /// that a new text document has been opened by the client.
61 ///
62 /// [`textDocument/didOpen`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_didOpen
63 ///
64 /// The document's truth is now managed by the client and the server must not try to read the
65 /// document’s truth using the document's URI. "Open" in this sense means it is managed by the
66 /// client. It doesn't necessarily mean that its content is presented in an editor.
67 fn did_open(&self, params: DidOpenTextDocumentParams) {
68 let _ = params;
69 eprintln!("Got a textDocument/didOpen notification, but it is not implemented");
70 }
71
72 /// The [`textDocument/didChange`] notification is sent from the client to the server to signal
73 /// changes to a text document.
74 ///
75 /// [`textDocument/didChange`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_didChange
76 ///
77 /// This notification will contain a distinct version tag and a list of edits made to the
78 /// document for the server to interpret.
79 fn did_change(&self, params: DidChangeTextDocumentParams) {
80 let _ = params;
81 eprintln!("Got a textDocument/didChange notification, but it is not implemented");
82 }
83
84 /// The [`textDocument/willSave`] notification is sent from the client to the server before the
85 /// document is actually saved.
86 ///
87 /// [`textDocument/willSave`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_willSave
88 fn will_save(&self, params: WillSaveTextDocumentParams) {
89 let _ = params;
90 eprintln!("Got a textDocument/willSave notification, but it is not implemented");
91 }
92
93 /// The [`textDocument/willSaveWaitUntil`] request is sent from the client to the server before
94 /// the document is actually saved.
95 ///
96 /// [`textDocument/willSaveWaitUntil`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_willSaveWaitUntil
97 ///
98 /// The request can return an array of `TextEdit`s which will be applied to the text document
99 /// before it is saved.
100 ///
101 /// Please note that clients might drop results if computing the text edits took too long or if
102 /// a server constantly fails on this request. This is done to keep the save fast and reliable.
103 fn will_save_wait_until(
104 &self,
105 params: WillSaveTextDocumentParams,
106 ) -> Result<Option<Vec<TextEdit>>> {
107 let _ = params;
108 eprintln!("Got a textDocument/willSaveWaitUntil request, but it is not implemented");
109 Err(Error::method_not_found())
110 }
111
112 /// The [`textDocument/didSave`] notification is sent from the client to the server when the
113 /// document was saved in the client.
114 ///
115 /// [`textDocument/didSave`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_didSave
116 fn did_save(&self, params: DidSaveTextDocumentParams) {
117 let _ = params;
118 eprintln!("Got a textDocument/didSave notification, but it is not implemented");
119 }
120
121 /// The [`textDocument/didClose`] notification is sent from the client to the server when the
122 /// document got closed in the client.
123 ///
124 /// [`textDocument/didClose`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_didClose
125 ///
126 /// The document's truth now exists where the document's URI points to (e.g. if the document's
127 /// URI is a file URI, the truth now exists on disk).
128 fn did_close(&self, params: DidCloseTextDocumentParams) {
129 let _ = params;
130 eprintln!("Got a textDocument/didClose notification, but it is not implemented");
131 }
132
133 // Language Features
134
135 /// The [`textDocument/declaration`] request asks the server for the declaration location of a
136 /// symbol at a given text document position.
137 ///
138 /// [`textDocument/declaration`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_declaration
139 ///
140 /// # Compatibility
141 ///
142 /// This request was introduced in specification version 3.14.0.
143 ///
144 /// The [`GotoDeclarationResponse::Link`](lsp_types::GotoDefinitionResponse::Link) return value
145 /// was introduced in specification version 3.14.0 and requires client-side support in order to
146 /// be used. It can be returned if the client set the following field to `true` in the
147 /// [`initialize`](Self::initialize) method:
148 ///
149 /// ```text
150 /// InitializeParams::capabilities::text_document::declaration::link_support
151 /// ```
152 fn goto_declaration(
153 &self,
154 params: GotoDeclarationParams,
155 ) -> Result<Option<GotoDeclarationResponse>> {
156 let _ = params;
157 eprintln!("Got a textDocument/declaration request, but it is not implemented");
158 Err(Error::method_not_found())
159 }
160
161 /// The [`textDocument/definition`] request asks the server for the definition location of a
162 /// symbol at a given text document position.
163 ///
164 /// [`textDocument/definition`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_definition
165 ///
166 /// # Compatibility
167 ///
168 /// The [`GotoDefinitionResponse::Link`](lsp_types::GotoDefinitionResponse::Link) return value
169 /// was introduced in specification version 3.14.0 and requires client-side support in order to
170 /// be used. It can be returned if the client set the following field to `true` in the
171 /// [`initialize`](Self::initialize) method:
172 ///
173 /// ```text
174 /// InitializeParams::capabilities::text_document::definition::link_support
175 /// ```
176 fn goto_definition(
177 &self,
178 params: GotoDefinitionParams,
179 ) -> Result<Option<GotoDefinitionResponse>> {
180 let _ = params;
181 eprintln!("Got a textDocument/definition request, but it is not implemented");
182 Err(Error::method_not_found())
183 }
184
185 /// The [`textDocument/typeDefinition`] request asks the server for the type definition location of
186 /// a symbol at a given text document position.
187 ///
188 /// [`textDocument/typeDefinition`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_typeDefinition
189 ///
190 /// # Compatibility
191 ///
192 /// This request was introduced in specification version 3.6.0.
193 ///
194 /// The [`GotoTypeDefinitionResponse::Link`](lsp_types::GotoDefinitionResponse::Link) return
195 /// value was introduced in specification version 3.14.0 and requires client-side support in
196 /// order to be used. It can be returned if the client set the following field to `true` in the
197 /// [`initialize`](Self::initialize) method:
198 ///
199 /// ```text
200 /// InitializeParams::capabilities::text_document::type_definition::link_support
201 /// ```
202 fn goto_type_definition(
203 &self,
204 params: GotoTypeDefinitionParams,
205 ) -> Result<Option<GotoTypeDefinitionResponse>> {
206 let _ = params;
207 eprintln!("Got a textDocument/typeDefinition request, but it is not implemented");
208 Err(Error::method_not_found())
209 }
210
211 /// The [`textDocument/implementation`] request is sent from the client to the server to resolve
212 /// the implementation location of a symbol at a given text document position.
213 ///
214 /// [`textDocument/implementation`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_implementation
215 ///
216 /// # Compatibility
217 ///
218 /// This request was introduced in specification version 3.6.0.
219 ///
220 /// The [`GotoImplementationResponse::Link`](lsp_types::GotoDefinitionResponse::Link)
221 /// return value was introduced in specification version 3.14.0 and requires client-side
222 /// support in order to be used. It can be returned if the client set the following field to
223 /// `true` in the [`initialize`](Self::initialize) method:
224 ///
225 /// ```text
226 /// InitializeParams::capabilities::text_document::implementation::link_support
227 /// ```
228 fn goto_implementation(
229 &self,
230 params: GotoImplementationParams,
231 ) -> Result<Option<GotoImplementationResponse>> {
232 let _ = params;
233 eprintln!("Got a textDocument/implementation request, but it is not implemented");
234 Err(Error::method_not_found())
235 }
236
237 /// The [`textDocument/references`] request is sent from the client to the server to resolve
238 /// project-wide references for the symbol denoted by the given text document position.
239 ///
240 /// [`textDocument/references`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_references
241
242 fn references(&self, params: ReferenceParams) -> Result<Option<Vec<Location>>> {
243 let _ = params;
244 eprintln!("Got a textDocument/references request, but it is not implemented");
245 Err(Error::method_not_found())
246 }
247
248 /// The [`textDocument/prepareCallHierarchy`] request is sent from the client to the server to
249 /// return a call hierarchy for the language element of given text document positions.
250 ///
251 /// [`textDocument/prepareCallHierarchy`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_prepareCallHierarchy
252 ///
253 /// The call hierarchy requests are executed in two steps:
254 ///
255 /// 1. First, a call hierarchy item is resolved for the given text document position (this
256 /// method).
257 /// 2. For a call hierarchy item, the incoming or outgoing call hierarchy items are resolved
258 /// inside [`incoming_calls`] and [`outgoing_calls`], respectively.
259 ///
260 /// [`incoming_calls`]: Self::incoming_calls
261 /// [`outgoing_calls`]: Self::outgoing_calls
262 ///
263 /// # Compatibility
264 ///
265 /// This request was introduced in specification version 3.16.0.
266 fn prepare_call_hierarchy(
267 &self,
268 params: CallHierarchyPrepareParams,
269 ) -> Result<Option<Vec<CallHierarchyItem>>> {
270 let _ = params;
271 eprintln!("Got a textDocument/prepareCallHierarchy request, but it is not implemented");
272 Err(Error::method_not_found())
273 }
274
275 /// The [`callHierarchy/incomingCalls`] request is sent from the client to the server to
276 /// resolve **incoming** calls for a given call hierarchy item.
277 ///
278 /// The request doesn't define its own client and server capabilities. It is only issued if a
279 /// server registers for the [`textDocument/prepareCallHierarchy`] request.
280 ///
281 /// [`callHierarchy/incomingCalls`]: https://microsoft.github.io/language-server-protocol/specification#callHierarchy_incomingCalls
282 /// [`textDocument/prepareCallHierarchy`]: Self::prepare_call_hierarchy
283 ///
284 /// # Compatibility
285 ///
286 /// This request was introduced in specification version 3.16.0.
287 fn incoming_calls(
288 &self,
289 params: CallHierarchyIncomingCallsParams,
290 ) -> Result<Option<Vec<CallHierarchyIncomingCall>>> {
291 let _ = params;
292 eprintln!("Got a callHierarchy/incomingCalls request, but it is not implemented");
293 Err(Error::method_not_found())
294 }
295
296 /// The [`callHierarchy/outgoingCalls`] request is sent from the client to the server to
297 /// resolve **outgoing** calls for a given call hierarchy item.
298 ///
299 /// The request doesn't define its own client and server capabilities. It is only issued if a
300 /// server registers for the [`textDocument/prepareCallHierarchy`] request.
301 ///
302 /// [`callHierarchy/outgoingCalls`]: https://microsoft.github.io/language-server-protocol/specification#callHierarchy_outgoingCalls
303 /// [`textDocument/prepareCallHierarchy`]: Self::prepare_call_hierarchy
304 ///
305 /// # Compatibility
306 ///
307 /// This request was introduced in specification version 3.16.0.
308 fn outgoing_calls(
309 &self,
310 params: CallHierarchyOutgoingCallsParams,
311 ) -> Result<Option<Vec<CallHierarchyOutgoingCall>>> {
312 let _ = params;
313 eprintln!("Got a callHierarchy/outgoingCalls request, but it is not implemented");
314 Err(Error::method_not_found())
315 }
316
317 /// The [`textDocument/prepareTypeHierarchy`] request is sent from the client to the server to
318 /// return a type hierarchy for the language element of given text document positions.
319 ///
320 /// [`textDocument/prepareTypeHierarchy`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_prepareTypeHierarchy
321 ///
322 /// Returns `Ok(None)` if the server couldn’t infer a valid type from the position.
323 ///
324 /// The type hierarchy requests are executed in two steps:
325 ///
326 /// 1. First, a type hierarchy item is prepared for the given text document position.
327 /// 2. For a type hierarchy item, the supertype or subtype type hierarchy items are resolved in
328 /// [`supertypes`](Self::supertypes) and [`subtypes`](Self::subtypes), respectively.
329 ///
330 /// # Compatibility
331 ///
332 /// This request was introduced in specification version 3.17.0.
333 fn prepare_type_hierarchy(
334 &self,
335 params: TypeHierarchyPrepareParams,
336 ) -> Result<Option<Vec<TypeHierarchyItem>>> {
337 let _ = params;
338 eprintln!("Got a textDocument/prepareTypeHierarchy request, but it is not implemented");
339 Err(Error::method_not_found())
340 }
341
342 /// The [`typeHierarchy/supertypes`] request is sent from the client to the server to resolve
343 /// the **supertypes** for a given type hierarchy item.
344 ///
345 /// Returns `Ok(None)` if the server couldn’t infer a valid type from item in `params`.
346 ///
347 /// The request doesn’t define its own client and server capabilities. It is only issued if a
348 /// server registers for the `textDocument/prepareTypeHierarchy` request.
349 ///
350 /// # Compatibility
351 ///
352 /// This request was introduced in specification version 3.17.0.
353 fn supertypes(
354 &self,
355 params: TypeHierarchySupertypesParams,
356 ) -> Result<Option<Vec<TypeHierarchyItem>>> {
357 let _ = params;
358 eprintln!("Got a typeHierarchy/supertypes request, but it is not implemented");
359 Err(Error::method_not_found())
360 }
361
362 /// The [`typeHierarchy/subtypes`] request is sent from the client to the server to resolve
363 /// the **subtypes** for a given type hierarchy item.
364 ///
365 /// Returns `Ok(None)` if the server couldn’t infer a valid type from item in `params`.
366 ///
367 /// The request doesn’t define its own client and server capabilities. It is only issued if a
368 /// server registers for the `textDocument/prepareTypeHierarchy` request.
369 ///
370 /// # Compatibility
371 ///
372 /// This request was introduced in specification version 3.17.0.
373 fn subtypes(
374 &self,
375 params: TypeHierarchySubtypesParams,
376 ) -> Result<Option<Vec<TypeHierarchyItem>>> {
377 let _ = params;
378 eprintln!("Got a typeHierarchy/subtypes request, but it is not implemented");
379 Err(Error::method_not_found())
380 }
381
382 /// The [`textDocument/documentHighlight`] request is sent from the client to the server to
383 /// resolve appropriate highlights for a given text document position.
384 ///
385 /// [`textDocument/documentHighlight`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_documentHighlight
386 ///
387 /// For programming languages, this usually highlights all textual references to the symbol
388 /// scoped to this file.
389 ///
390 /// This request differs slightly from `textDocument/references` in that this one is allowed to
391 /// be more fuzzy.
392 fn document_highlight(
393 &self,
394 params: DocumentHighlightParams,
395 ) -> Result<Option<Vec<DocumentHighlight>>> {
396 let _ = params;
397 eprintln!("Got a textDocument/documentHighlight request, but it is not implemented");
398 Err(Error::method_not_found())
399 }
400
401 /// The [`textDocument/documentLink`] request is sent from the client to the server to request
402 /// the location of links in a document.
403 ///
404 /// A document link is a range in a text document that links to an internal or external
405 /// resource, like another text document or a web site.
406 ///
407 /// [`textDocument/documentLink`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_documentLink
408 ///
409 /// # Compatibility
410 ///
411 /// The [`DocumentLink::tooltip`] field was introduced in specification version 3.15.0 and
412 /// requires client-side support in order to be used. It can be returned if the client set the
413 /// following field to `true` in the [`initialize`](Self::initialize) method:
414 ///
415 /// ```text
416 /// InitializeParams::capabilities::text_document::document_link::tooltip_support
417 /// ```
418 fn document_link(&self, params: DocumentLinkParams) -> Result<Option<Vec<DocumentLink>>> {
419 let _ = params;
420 eprintln!("Got a textDocument/documentLink request, but it is not implemented");
421 Err(Error::method_not_found())
422 }
423
424 /// The [`documentLink/resolve`] request is sent from the client to the server to resolve the
425 /// target of a given document link.
426 ///
427 /// [`documentLink/resolve`]: https://microsoft.github.io/language-server-protocol/specification#documentLink_resolve
428 ///
429 /// A document link is a range in a text document that links to an internal or external
430 /// resource, like another text document or a web site.
431 fn document_link_resolve(&self, params: DocumentLink) -> Result<DocumentLink> {
432 let _ = params;
433 eprintln!("Got a documentLink/resolve request, but it is not implemented");
434 Err(Error::method_not_found())
435 }
436
437 /// The [`textDocument/hover`] request asks the server for hover information at a given text
438 /// document position.
439 ///
440 /// [`textDocument/hover`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_hover
441 ///
442 /// Such hover information typically includes type signature information and inline
443 /// documentation for the symbol at the given text document position.
444 fn hover(&self, params: HoverParams) -> Result<Option<Hover>> {
445 let _ = params;
446 eprintln!("Got a textDocument/hover request, but it is not implemented");
447 Err(Error::method_not_found())
448 }
449
450 /// The [`textDocument/codeLens`] request is sent from the client to the server to compute code
451 /// lenses for a given text document.
452 ///
453 /// [`textDocument/codeLens`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_codeLens
454
455 fn code_lens(&self, params: CodeLensParams) -> Result<Option<Vec<CodeLens>>> {
456 let _ = params;
457 eprintln!("Got a textDocument/codeLens request, but it is not implemented");
458 Err(Error::method_not_found())
459 }
460
461 /// The [`codeLens/resolve`] request is sent from the client to the server to resolve the
462 /// command for a given code lens item.
463 ///
464 /// [`codeLens/resolve`]: https://microsoft.github.io/language-server-protocol/specification#codeLens_resolve
465
466 fn code_lens_resolve(&self, params: CodeLens) -> Result<CodeLens> {
467 let _ = params;
468 eprintln!("Got a codeLens/resolve request, but it is not implemented");
469 Err(Error::method_not_found())
470 }
471
472 /// The [`textDocument/foldingRange`] request is sent from the client to the server to return
473 /// all folding ranges found in a given text document.
474 ///
475 /// [`textDocument/foldingRange`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_foldingRange
476 ///
477 /// # Compatibility
478 ///
479 /// This request was introduced in specification version 3.10.0.
480
481 fn folding_range(&self, params: FoldingRangeParams) -> Result<Option<Vec<FoldingRange>>> {
482 let _ = params;
483 eprintln!("Got a textDocument/foldingRange request, but it is not implemented");
484 Err(Error::method_not_found())
485 }
486
487 /// The [`textDocument/selectionRange`] request is sent from the client to the server to return
488 /// suggested selection ranges at an array of given positions. A selection range is a range
489 /// around the cursor position which the user might be interested in selecting.
490 ///
491 /// [`textDocument/selectionRange`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_selectionRange
492 ///
493 /// A selection range in the return array is for the position in the provided parameters at the
494 /// same index. Therefore `params.positions[i]` must be contained in `result[i].range`.
495 ///
496 /// # Compatibility
497 ///
498 /// This request was introduced in specification version 3.15.0.
499
500 fn selection_range(&self, params: SelectionRangeParams) -> Result<Option<Vec<SelectionRange>>> {
501 let _ = params;
502 eprintln!("Got a textDocument/selectionRange request, but it is not implemented");
503 Err(Error::method_not_found())
504 }
505
506 /// The [`textDocument/documentSymbol`] request is sent from the client to the server to
507 /// retrieve all symbols found in a given text document.
508 ///
509 /// [`textDocument/documentSymbol`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_documentSymbol
510 ///
511 /// The returned result is either:
512 ///
513 /// * [`DocumentSymbolResponse::Flat`] which is a flat list of all symbols found in a given
514 /// text document. Then neither the symbol’s location range nor the symbol’s container name
515 /// should be used to infer a hierarchy.
516 /// * [`DocumentSymbolResponse::Nested`] which is a hierarchy of symbols found in a given text
517 /// document.
518
519 fn document_symbol(
520 &self,
521 params: DocumentSymbolParams,
522 ) -> Result<Option<DocumentSymbolResponse>> {
523 let _ = params;
524 eprintln!("Got a textDocument/documentSymbol request, but it is not implemented");
525 Err(Error::method_not_found())
526 }
527
528 /// The [`textDocument/semanticTokens/full`] request is sent from the client to the server to
529 /// resolve the semantic tokens of a given file.
530 ///
531 /// [`textDocument/semanticTokens/full`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_semanticTokens
532 ///
533 /// Semantic tokens are used to add additional color information to a file that depends on
534 /// language specific symbol information. A semantic token request usually produces a large
535 /// result. The protocol therefore supports encoding tokens with numbers. In addition, optional
536 /// support for deltas is available, i.e. [`semantic_tokens_full_delta`].
537 ///
538 /// [`semantic_tokens_full_delta`]: Self::semantic_tokens_full_delta
539 ///
540 /// # Compatibility
541 ///
542 /// This request was introduced in specification version 3.16.0.
543
544 fn semantic_tokens_full(
545 &self,
546 params: SemanticTokensParams,
547 ) -> Result<Option<SemanticTokensResult>> {
548 let _ = params;
549 eprintln!("Got a textDocument/semanticTokens/full request, but it is not implemented");
550 Err(Error::method_not_found())
551 }
552
553 /// The [`textDocument/semanticTokens/full/delta`] request is sent from the client to the server to
554 /// resolve the semantic tokens of a given file, **returning only the delta**.
555 ///
556 /// [`textDocument/semanticTokens/full/delta`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_semanticTokens
557 ///
558 /// Similar to [`semantic_tokens_full`](Self::semantic_tokens_full), except it returns a
559 /// sequence of [`SemanticTokensEdit`] to transform a previous result into a new result.
560 ///
561 /// # Compatibility
562 ///
563 /// This request was introduced in specification version 3.16.0.
564
565 fn semantic_tokens_full_delta(
566 &self,
567 params: SemanticTokensDeltaParams,
568 ) -> Result<Option<SemanticTokensFullDeltaResult>> {
569 let _ = params;
570 eprintln!(
571 "Got a textDocument/semanticTokens/full/delta request, but it is not implemented"
572 );
573 Err(Error::method_not_found())
574 }
575
576 /// The [`textDocument/semanticTokens/range`] request is sent from the client to the server to
577 /// resolve the semantic tokens **for the visible range** of a given file.
578 ///
579 /// [`textDocument/semanticTokens/range`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_semanticTokens
580 ///
581 /// When a user opens a file, it can be beneficial to only compute the semantic tokens for the
582 /// visible range (faster rendering of the tokens in the user interface). If a server can
583 /// compute these tokens faster than for the whole file, it can implement this method to handle
584 /// this special case.
585 ///
586 /// See the [`semantic_tokens_full`](Self::semantic_tokens_full) documentation for more
587 /// details.
588 ///
589 /// # Compatibility
590 ///
591 /// This request was introduced in specification version 3.16.0.
592
593 fn semantic_tokens_range(
594 &self,
595 params: SemanticTokensRangeParams,
596 ) -> Result<Option<SemanticTokensRangeResult>> {
597 let _ = params;
598 eprintln!("Got a textDocument/semanticTokens/range request, but it is not implemented");
599 Err(Error::method_not_found())
600 }
601
602 /// The [`textDocument/inlineValue`] request is sent from the client to the server to compute
603 /// inline values for a given text document that may be rendered in the editor at the end of
604 /// lines.
605 ///
606 /// [`textDocument/inlineValue`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_inlineValue
607 ///
608 /// # Compatibility
609 ///
610 /// This request was introduced in specification version 3.17.0.
611
612 fn inline_value(&self, params: InlineValueParams) -> Result<Option<Vec<InlineValue>>> {
613 let _ = params;
614 eprintln!("Got a textDocument/inlineValue request, but it is not implemented");
615 Err(Error::method_not_found())
616 }
617
618 /// The [`textDocument/inlayHint`] request is sent from the client to the server to compute
619 /// inlay hints for a given `(text document, range)` tuple that may be rendered in the editor
620 /// in place with other text.
621 ///
622 /// [`textDocument/inlayHint`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_inlayHint
623 ///
624 /// # Compatibility
625 ///
626 /// This request was introduced in specification version 3.17.0
627
628 fn inlay_hint(&self, params: InlayHintParams) -> Result<Option<Vec<InlayHint>>> {
629 let _ = params;
630 eprintln!("Got a textDocument/inlayHint request, but it is not implemented");
631 Err(Error::method_not_found())
632 }
633
634 /// The [`inlayHint/resolve`] request is sent from the client to the server to resolve
635 /// additional information for a given inlay hint.
636 ///
637 /// [`inlayHint/resolve`]: https://microsoft.github.io/language-server-protocol/specification#inlayHint_resolve
638 ///
639 /// This is usually used to compute the tooltip, location or command properties of an inlay
640 /// hint’s label part to avoid its unnecessary computation during the `textDocument/inlayHint`
641 /// request.
642 ///
643 /// Consider a client announces the `label.location` property as a property that can be
644 /// resolved lazily using the client capability:
645 ///
646 /// ```js
647 /// textDocument.inlayHint.resolveSupport = { properties: ['label.location'] };
648 /// ```
649 ///
650 /// then an inlay hint with a label part, but without a location, must be resolved using the
651 /// `inlayHint/resolve` request before it can be used.
652 ///
653 /// # Compatibility
654 ///
655 /// This request was introduced in specification version 3.17.0
656
657 fn inlay_hint_resolve(&self, params: InlayHint) -> Result<InlayHint> {
658 let _ = params;
659 eprintln!("Got a inlayHint/resolve request, but it is not implemented");
660 Err(Error::method_not_found())
661 }
662
663 /// The [`textDocument/moniker`] request is sent from the client to the server to get the
664 /// symbol monikers for a given text document position.
665 ///
666 /// [`textDocument/moniker`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_moniker
667 ///
668 /// An array of `Moniker` types is returned as response to indicate possible monikers at the
669 /// given location. If no monikers can be calculated, `Some(vec![])` or `None` should be
670 /// returned.
671 ///
672 /// # Concept
673 ///
674 /// The Language Server Index Format (LSIF) introduced the concept of _symbol monikers_ to help
675 /// associate symbols across different indexes. This request adds capability for LSP server
676 /// implementations to provide the same symbol moniker information given a text document
677 /// position.
678 ///
679 /// Clients can utilize this method to get the moniker at the current location in a file the
680 /// user is editing and do further code navigation queries in other services that rely on LSIF
681 /// indexes and link symbols together.
682 ///
683 /// # Compatibility
684 ///
685 /// This request was introduced in specification version 3.16.0.
686
687 fn moniker(&self, params: MonikerParams) -> Result<Option<Vec<Moniker>>> {
688 let _ = params;
689 eprintln!("Got a textDocument/moniker request, but it is not implemented");
690 Err(Error::method_not_found())
691 }
692
693 /// The [`textDocument/completion`] request is sent from the client to the server to compute
694 /// completion items at a given cursor position.
695 ///
696 /// If computing full completion items is expensive, servers can additionally provide a handler
697 /// for the completion item resolve request (`completionItem/resolve`). This request is sent
698 /// when a completion item is selected in the user interface.
699 ///
700 /// [`textDocument/completion`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_completion
701 ///
702 /// # Compatibility
703 ///
704 /// Since 3.16.0, the client can signal that it can resolve more properties lazily. This is
705 /// done using the `completion_item.resolve_support` client capability which lists all
706 /// properties that can be filled in during a `completionItem/resolve` request.
707 ///
708 /// All other properties (usually `sort_text`, `filter_text`, `insert_text`, and `text_edit`)
709 /// must be provided in the `textDocument/completion` response and must not be changed during
710 /// resolve.
711
712 fn completion(&self, params: CompletionParams) -> Result<Option<CompletionResponse>> {
713 let _ = params;
714 eprintln!("Got a textDocument/completion request, but it is not implemented");
715 Err(Error::method_not_found())
716 }
717
718 /// The [`completionItem/resolve`] request is sent from the client to the server to resolve
719 /// additional information for a given completion item.
720 ///
721 /// [`completionItem/resolve`]: https://microsoft.github.io/language-server-protocol/specification#completionItem_resolve
722
723 fn completion_resolve(&self, params: CompletionItem) -> Result<CompletionItem> {
724 let _ = params;
725 eprintln!("Got a completionItem/resolve request, but it is not implemented");
726 Err(Error::method_not_found())
727 }
728
729 /// The [`textDocument/diagnostic`] request is sent from the client to the server to ask the
730 /// server to compute the diagnostics for a given document.
731 ///
732 /// As with other pull requests, the server is asked to compute the diagnostics for the
733 /// currently synced version of the document.
734 ///
735 /// The request doesn't define its own client and server capabilities. It is only issued if a
736 /// server registers for the [`textDocument/diagnostic`] request.
737 ///
738 /// [`textDocument/diagnostic`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_diagnostic
739 ///
740 /// # Compatibility
741 ///
742 /// This request was introduced in specification version 3.17.0.
743
744 fn diagnostic(
745 &self,
746 params: DocumentDiagnosticParams,
747 ) -> Result<DocumentDiagnosticReportResult> {
748 let _ = params;
749 eprintln!("Got a textDocument/diagnostic request, but it is not implemented");
750 Err(Error::method_not_found())
751 }
752
753 /// The [`workspace/diagnostic`] request is sent from the client to the server to ask the
754 /// server to compute workspace wide diagnostics which previously where pushed from the server
755 /// to the client.
756 ///
757 /// In contrast to the [`textDocument/diagnostic`] request, the workspace request can be
758 /// long-running and is not bound to a specific workspace or document state. If the client
759 /// supports streaming for the workspace diagnostic pull, it is legal to provide a
760 /// `textDocument/diagnostic` report multiple times for the same document URI. The last one
761 /// reported will win over previous reports.
762 ///
763 /// [`textDocument/diagnostic`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_diagnostic
764 ///
765 /// If a client receives a diagnostic report for a document in a workspace diagnostic request
766 /// for which the client also issues individual document diagnostic pull requests, the client
767 /// needs to decide which diagnostics win and should be presented. In general:
768 ///
769 /// * Diagnostics for a higher document version should win over those from a lower document
770 /// version (e.g. note that document versions are steadily increasing).
771 /// * Diagnostics from a document pull should win over diagnostics from a workspace pull.
772 ///
773 /// The request doesn't define its own client and server capabilities. It is only issued if a
774 /// server registers for the [`workspace/diagnostic`] request.
775 ///
776 /// [`workspace/diagnostic`]: https://microsoft.github.io/language-server-protocol/specification#workspace_diagnostic
777 ///
778 /// # Compatibility
779 ///
780 /// This request was introduced in specification version 3.17.0.
781
782 fn workspace_diagnostic(
783 &self,
784 params: WorkspaceDiagnosticParams,
785 ) -> Result<WorkspaceDiagnosticReportResult> {
786 let _ = params;
787 eprintln!("Got a workspace/diagnostic request, but it is not implemented");
788 Err(Error::method_not_found())
789 }
790
791 /// The [`textDocument/signatureHelp`] request is sent from the client to the server to request
792 /// signature information at a given cursor position.
793 ///
794 /// [`textDocument/signatureHelp`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_signatureHelp
795
796 fn signature_help(&self, params: SignatureHelpParams) -> Result<Option<SignatureHelp>> {
797 let _ = params;
798 eprintln!("Got a textDocument/signatureHelp request, but it is not implemented");
799 Err(Error::method_not_found())
800 }
801
802 /// The [`textDocument/codeAction`] request is sent from the client to the server to compute
803 /// commands for a given text document and range. These commands are typically code fixes to
804 /// either fix problems or to beautify/refactor code.
805 ///
806 /// The result of a [`textDocument/codeAction`] request is an array of `Command` literals which
807 /// are typically presented in the user interface.
808 ///
809 /// [`textDocument/codeAction`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_codeAction
810 ///
811 /// To ensure that a server is useful in many clients, the commands specified in a code actions
812 /// should be handled by the server and not by the client (see [`workspace/executeCommand`] and
813 /// `ServerCapabilities::execute_command_provider`). If the client supports providing edits
814 /// with a code action, then the mode should be used.
815 ///
816 /// When the command is selected the server should be contacted again (via the
817 /// [`workspace/executeCommand`] request) to execute the command.
818 ///
819 /// [`workspace/executeCommand`]: https://microsoft.github.io/language-server-protocol/specification#workspace_executeCommand
820 ///
821 /// # Compatibility
822 ///
823 /// ## Since version 3.16.0
824 ///
825 /// A client can offer a server to delay the computation of code action properties during a
826 /// `textDocument/codeAction` request. This is useful for cases where it is expensive to
827 /// compute the value of a property (for example, the `edit` property).
828 ///
829 /// Clients signal this through the `code_action.resolve_support` client capability which lists
830 /// all properties a client can resolve lazily. The server capability
831 /// `code_action_provider.resolve_provider` signals that a server will offer a
832 /// `codeAction/resolve` route.
833 ///
834 /// To help servers uniquely identify a code action in the resolve request, a code action
835 /// literal may optionally carry a `data` property. This is also guarded by an additional
836 /// client capability `code_action.data_support`. In general, a client should offer data
837 /// support if it offers resolve support.
838 ///
839 /// It should also be noted that servers shouldn’t alter existing attributes of a code action
840 /// in a `codeAction/resolve` request.
841 ///
842 /// ## Since version 3.8.0
843 ///
844 /// Support for [`CodeAction`] literals to enable the following scenarios:
845 ///
846 /// * The ability to directly return a workspace edit from the code action request.
847 /// This avoids having another server roundtrip to execute an actual code action.
848 /// However server providers should be aware that if the code action is expensive to compute
849 /// or the edits are huge it might still be beneficial if the result is simply a command and
850 /// the actual edit is only computed when needed.
851 ///
852 /// * The ability to group code actions using a kind. Clients are allowed to ignore that
853 /// information. However it allows them to better group code action, for example, into
854 /// corresponding menus (e.g. all refactor code actions into a refactor menu).
855
856 fn code_action(&self, params: CodeActionParams) -> Result<Option<CodeActionResponse>> {
857 let _ = params;
858 eprintln!("Got a textDocument/codeAction request, but it is not implemented");
859 Err(Error::method_not_found())
860 }
861
862 /// The [`codeAction/resolve`] request is sent from the client to the server to resolve
863 /// additional information for a given code action.
864 ///
865 /// [`codeAction/resolve`]: https://microsoft.github.io/language-server-protocol/specification#codeAction_resolve
866 ///
867 /// This is usually used to compute the edit property of a [`CodeAction`] to avoid its
868 /// unnecessary computation during the [`textDocument/codeAction`](Self::code_action) request.
869 ///
870 /// # Compatibility
871 ///
872 /// This request was introduced in specification version 3.16.0.
873
874 fn code_action_resolve(&self, params: CodeAction) -> Result<CodeAction> {
875 let _ = params;
876 eprintln!("Got a codeAction/resolve request, but it is not implemented");
877 Err(Error::method_not_found())
878 }
879
880 /// The [`textDocument/documentColor`] request is sent from the client to the server to list
881 /// all color references found in a given text document. Along with the range, a color value in
882 /// RGB is returned.
883 ///
884 /// [`textDocument/documentColor`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_documentColor
885 ///
886 /// Clients can use the result to decorate color references in an editor. For example:
887 ///
888 /// * Color boxes showing the actual color next to the reference
889 /// * Show a color picker when a color reference is edited
890 ///
891 /// # Compatibility
892 ///
893 /// This request was introduced in specification version 3.6.0.
894
895 fn document_color(&self, params: DocumentColorParams) -> Result<Vec<ColorInformation>> {
896 let _ = params;
897 eprintln!("Got a textDocument/documentColor request, but it is not implemented");
898 Err(Error::method_not_found())
899 }
900
901 /// The [`textDocument/colorPresentation`] request is sent from the client to the server to
902 /// obtain a list of presentations for a color value at a given location.
903 ///
904 /// [`textDocument/colorPresentation`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_colorPresentation
905 ///
906 /// Clients can use the result to:
907 ///
908 /// * Modify a color reference
909 /// * Show in a color picker and let users pick one of the presentations
910 ///
911 /// # Compatibility
912 ///
913 /// This request was introduced in specification version 3.6.0.
914 ///
915 /// This request has no special capabilities and registration options since it is sent as a
916 /// resolve request for the [`textDocument/documentColor`](Self::document_color) request.
917
918 fn color_presentation(
919 &self,
920 params: ColorPresentationParams,
921 ) -> Result<Vec<ColorPresentation>> {
922 let _ = params;
923 eprintln!("Got a textDocument/colorPresentation request, but it is not implemented");
924 Err(Error::method_not_found())
925 }
926
927 /// The [`textDocument/formatting`] request is sent from the client to the server to format a
928 /// whole document.
929 ///
930 /// [`textDocument/formatting`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting
931
932 fn formatting(&self, params: DocumentFormattingParams) -> Result<Option<Vec<TextEdit>>> {
933 let _ = params;
934 eprintln!("Got a textDocument/formatting request, but it is not implemented");
935 Err(Error::method_not_found())
936 }
937
938 /// The [`textDocument/rangeFormatting`] request is sent from the client to the server to
939 /// format a given range in a document.
940 ///
941 /// [`textDocument/rangeFormatting`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_rangeFormatting
942
943 fn range_formatting(
944 &self,
945 params: DocumentRangeFormattingParams,
946 ) -> Result<Option<Vec<TextEdit>>> {
947 let _ = params;
948 eprintln!("Got a textDocument/rangeFormatting request, but it is not implemented");
949 Err(Error::method_not_found())
950 }
951
952 /// The [`textDocument/onTypeFormatting`] request is sent from the client to the server to
953 /// format parts of the document during typing.
954 ///
955 /// [`textDocument/onTypeFormatting`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_onTypeFormatting
956
957 fn on_type_formatting(
958 &self,
959 params: DocumentOnTypeFormattingParams,
960 ) -> Result<Option<Vec<TextEdit>>> {
961 let _ = params;
962 eprintln!("Got a textDocument/onTypeFormatting request, but it is not implemented");
963 Err(Error::method_not_found())
964 }
965
966 /// The [`textDocument/rename`] request is sent from the client to the server to ask the server
967 /// to compute a workspace change so that the client can perform a workspace-wide rename of a
968 /// symbol.
969 ///
970 /// [`textDocument/rename`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_rename
971
972 fn rename(&self, params: RenameParams) -> Result<Option<WorkspaceEdit>> {
973 let _ = params;
974 eprintln!("Got a textDocument/rename request, but it is not implemented");
975 Err(Error::method_not_found())
976 }
977
978 /// The [`textDocument/prepareRename`] request is sent from the client to the server to setup
979 /// and test the validity of a rename operation at a given location.
980 ///
981 /// [`textDocument/prepareRename`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_prepareRename
982 ///
983 /// # Compatibility
984 ///
985 /// This request was introduced in specification version 3.12.0.
986
987 fn prepare_rename(
988 &self,
989 params: TextDocumentPositionParams,
990 ) -> Result<Option<PrepareRenameResponse>> {
991 let _ = params;
992 eprintln!("Got a textDocument/prepareRename request, but it is not implemented");
993 Err(Error::method_not_found())
994 }
995
996 /// The [`textDocument/linkedEditingRange`] request is sent from the client to the server to
997 /// return for a given position in a document the range of the symbol at the position and all
998 /// ranges that have the same content.
999 ///
1000 /// [`textDocument/linkedEditingRange`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_linkedEditingRange
1001 ///
1002 /// Optionally a word pattern can be returned to describe valid contents.
1003 ///
1004 /// A rename to one of the ranges can be applied to all other ranges if the new content is
1005 /// valid. If no result-specific word pattern is provided, the word pattern from the client's
1006 /// language configuration is used.
1007 ///
1008 /// # Compatibility
1009 ///
1010 /// This request was introduced in specification version 3.16.0.
1011
1012 fn linked_editing_range(
1013 &self,
1014 params: LinkedEditingRangeParams,
1015 ) -> Result<Option<LinkedEditingRanges>> {
1016 let _ = params;
1017 eprintln!("Got a textDocument/linkedEditingRange request, but it is not implemented");
1018 Err(Error::method_not_found())
1019 }
1020
1021 // Workspace Features
1022
1023 /// The [`workspace/symbol`] request is sent from the client to the server to list project-wide
1024 /// symbols matching the given query string.
1025 ///
1026 /// [`workspace/symbol`]: https://microsoft.github.io/language-server-protocol/specification#workspace_symbol
1027 ///
1028 /// # Compatibility
1029 ///
1030 /// Since 3.17.0, servers can also provider a handler for [`workspaceSymbol/resolve`] requests.
1031 /// This allows servers to return workspace symbols without a range for a `workspace/symbol`
1032 /// request. Clients then need to resolve the range when necessary using the
1033 /// `workspaceSymbol/resolve` request.
1034 ///
1035 /// [`workspaceSymbol/resolve`]: Self::symbol_resolve
1036 ///
1037 /// Servers can only use this new model if clients advertise support for it via the
1038 /// `workspace.symbol.resolve_support` capability.
1039
1040 fn symbol(&self, params: WorkspaceSymbolParams) -> Result<Option<Vec<SymbolInformation>>> {
1041 let _ = params;
1042 eprintln!("Got a workspace/symbol request, but it is not implemented");
1043 Err(Error::method_not_found())
1044 }
1045
1046 /// The [`workspaceSymbol/resolve`] request is sent from the client to the server to resolve
1047 /// additional information for a given workspace symbol.
1048 ///
1049 /// [`workspaceSymbol/resolve`]: https://microsoft.github.io/language-server-protocol/specification#workspace_symbolResolve
1050 ///
1051 /// See the [`symbol`](Self::symbol) documentation for more details.
1052 ///
1053 /// # Compatibility
1054 ///
1055 /// This request was introduced in specification version 3.17.0.
1056
1057 fn symbol_resolve(&self, params: WorkspaceSymbol) -> Result<WorkspaceSymbol> {
1058 let _ = params;
1059 eprintln!("Got a workspaceSymbol/resolve request, but it is not implemented");
1060 Err(Error::method_not_found())
1061 }
1062
1063 /// The [`workspace/didChangeConfiguration`] notification is sent from the client to the server
1064 /// to signal the change of configuration settings.
1065 ///
1066 /// [`workspace/didChangeConfiguration`]: https://microsoft.github.io/language-server-protocol/specification#workspace_didChangeConfiguration
1067
1068 fn did_change_configuration(&self, params: DidChangeConfigurationParams) {
1069 let _ = params;
1070 eprintln!("Got a workspace/didChangeConfiguration notification, but it is not implemented");
1071 }
1072
1073 /// The [`workspace/didChangeWorkspaceFolders`] notification is sent from the client to the
1074 /// server to inform about workspace folder configuration changes.
1075 ///
1076 /// [`workspace/didChangeWorkspaceFolders`]: https://microsoft.github.io/language-server-protocol/specification#workspace_didChangeWorkspaceFolders
1077 ///
1078 /// The notification is sent by default if both of these boolean fields were set to `true` in
1079 /// the [`initialize`](Self::initialize) method:
1080 ///
1081 /// * `InitializeParams::capabilities::workspace::workspace_folders`
1082 /// * `InitializeResult::capabilities::workspace::workspace_folders::supported`
1083 ///
1084 /// This notification is also sent if the server has registered itself to receive this
1085 /// notification.
1086
1087 fn did_change_workspace_folders(&self, params: DidChangeWorkspaceFoldersParams) {
1088 let _ = params;
1089 eprintln!(
1090 "Got a workspace/didChangeWorkspaceFolders notification, but it is not implemented"
1091 );
1092 }
1093
1094 /// The [`workspace/willCreateFiles`] request is sent from the client to the server before
1095 /// files are actually created as long as the creation is triggered from within the client.
1096 ///
1097 /// [`workspace/willCreateFiles`]: https://microsoft.github.io/language-server-protocol/specification#workspace_willCreateFiles
1098 ///
1099 /// The request can return a [`WorkspaceEdit`] which will be applied to workspace before the
1100 /// files are created. Please note that clients might drop results if computing the edit took
1101 /// too long or if a server constantly fails on this request. This is done to keep creates fast
1102 /// and reliable.
1103 ///
1104 /// # Compatibility
1105 ///
1106 /// This request was introduced in specification version 3.16.0.
1107
1108 fn will_create_files(&self, params: CreateFilesParams) -> Result<Option<WorkspaceEdit>> {
1109 let _ = params;
1110 eprintln!("Got a workspace/willCreateFiles request, but it is not implemented");
1111 Err(Error::method_not_found())
1112 }
1113
1114 /// The [`workspace/didCreateFiles`] request is sent from the client to the server when files
1115 /// were created from within the client.
1116 ///
1117 /// [`workspace/didCreateFiles`]: https://microsoft.github.io/language-server-protocol/specification#workspace_didCreateFiles
1118
1119 fn did_create_files(&self, params: CreateFilesParams) {
1120 let _ = params;
1121 eprintln!("Got a workspace/didCreateFiles notification, but it is not implemented");
1122 }
1123
1124 /// The [`workspace/willRenameFiles`] request is sent from the client to the server before
1125 /// files are actually renamed as long as the rename is triggered from within the client.
1126 ///
1127 /// [`workspace/willRenameFiles`]: https://microsoft.github.io/language-server-protocol/specification#workspace_willRenameFiles
1128 ///
1129 /// The request can return a [`WorkspaceEdit`] which will be applied to workspace before the
1130 /// files are renamed. Please note that clients might drop results if computing the edit took
1131 /// too long or if a server constantly fails on this request. This is done to keep creates fast
1132 /// and reliable.
1133 ///
1134 /// # Compatibility
1135 ///
1136 /// This request was introduced in specification version 3.16.0.
1137
1138 fn will_rename_files(&self, params: RenameFilesParams) -> Result<Option<WorkspaceEdit>> {
1139 let _ = params;
1140 eprintln!("Got a workspace/willRenameFiles request, but it is not implemented");
1141 Err(Error::method_not_found())
1142 }
1143
1144 /// The [`workspace/didRenameFiles`] notification is sent from the client to the server when
1145 /// files were renamed from within the client.
1146 ///
1147 /// [`workspace/didRenameFiles`]: https://microsoft.github.io/language-server-protocol/specification#workspace_didRenameFiles
1148
1149 fn did_rename_files(&self, params: RenameFilesParams) {
1150 let _ = params;
1151 eprintln!("Got a workspace/didRenameFiles notification, but it is not implemented");
1152 }
1153
1154 /// The [`workspace/willDeleteFiles`] request is sent from the client to the server before
1155 /// files are actually deleted as long as the deletion is triggered from within the client
1156 /// either by a user action or by applying a workspace edit.
1157 ///
1158 /// [`workspace/willDeleteFiles`]: https://microsoft.github.io/language-server-protocol/specification#workspace_willDeleteFiles
1159 ///
1160 /// The request can return a [`WorkspaceEdit`] which will be applied to workspace before the
1161 /// files are deleted. Please note that clients might drop results if computing the edit took
1162 /// too long or if a server constantly fails on this request. This is done to keep deletions
1163 /// fast and reliable.
1164 ///
1165 /// # Compatibility
1166 ///
1167 /// This request was introduced in specification version 3.16.0.
1168
1169 fn will_delete_files(&self, params: DeleteFilesParams) -> Result<Option<WorkspaceEdit>> {
1170 let _ = params;
1171 eprintln!("Got a workspace/willDeleteFiles request, but it is not implemented");
1172 Err(Error::method_not_found())
1173 }
1174
1175 /// The [`workspace/didDeleteFiles`] notification is sent from the client to the server when
1176 /// files were deleted from within the client.
1177 ///
1178 /// [`workspace/didDeleteFiles`]: https://microsoft.github.io/language-server-protocol/specification#workspace_didDeleteFiles
1179
1180 fn did_delete_files(&self, params: DeleteFilesParams) {
1181 let _ = params;
1182 eprintln!("Got a workspace/didDeleteFiles notification, but it is not implemented");
1183 }
1184
1185 /// The [`workspace/didChangeWatchedFiles`] notification is sent from the client to the server
1186 /// when the client detects changes to files watched by the language client.
1187 ///
1188 /// [`workspace/didChangeWatchedFiles`]: https://microsoft.github.io/language-server-protocol/specification#workspace_didChangeWatchedFiles
1189 ///
1190 /// It is recommended that servers register for these file events using the registration
1191 /// mechanism. This can be done here or in the [`initialized`](Self::initialized) method using
1192 /// [`Client::register_capability`](crate::Client::register_capability).
1193
1194 fn did_change_watched_files(&self, params: DidChangeWatchedFilesParams) {
1195 let _ = params;
1196 eprintln!("Got a workspace/didChangeWatchedFiles notification, but it is not implemented");
1197 }
1198
1199 /// The [`workspace/executeCommand`] request is sent from the client to the server to trigger
1200 /// command execution on the server.
1201 ///
1202 /// [`workspace/executeCommand`]: https://microsoft.github.io/language-server-protocol/specification#workspace_executeCommand
1203 ///
1204 /// In most cases, the server creates a [`WorkspaceEdit`] structure and applies the changes to
1205 /// the workspace using `Client::apply_edit()` before returning from this function.
1206
1207 fn execute_command(&self, params: ExecuteCommandParams) -> Result<Option<Value>> {
1208 let _ = params;
1209 eprintln!("Got a workspace/executeCommand request, but it is not implemented");
1210 Err(Error::method_not_found())
1211 }
1212
1213 // TODO: Add `work_done_progress_cancel()` here (since 3.15.0) when supported by `tower-lsp`.
1214 // https://github.com/ebkalderon/tower-lsp/issues/176
1215}