]> git.proxmox.com Git - rustc.git/blob - vendor/lsp-types/src/request.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / vendor / lsp-types / src / request.rs
1 use super::*;
2
3 use serde::{de::DeserializeOwned, Serialize};
4
5 pub trait Request {
6 type Params: DeserializeOwned + Serialize;
7 type Result: DeserializeOwned + Serialize;
8 const METHOD: &'static str;
9 }
10
11 #[macro_export]
12 macro_rules! lsp_request {
13 ("initialize") => {
14 $crate::request::Initialize
15 };
16 ("shutdown") => {
17 $crate::request::Shutdown
18 };
19
20 ("window/showMessageRequest") => {
21 $crate::request::ShowMessageRequest
22 };
23
24 ("client/registerCapability") => {
25 $crate::request::RegisterCapability
26 };
27 ("client/unregisterCapability") => {
28 $crate::request::UnregisterCapability
29 };
30
31 ("workspace/symbol") => {
32 $crate::request::WorkspaceSymbol
33 };
34 ("workspace/executeCommand") => {
35 $crate::request::ExecuteCommand
36 };
37
38 ("textDocument/willSaveWaitUntil") => {
39 $crate::request::WillSaveWaitUntil
40 };
41
42 ("textDocument/completion") => {
43 $crate::request::Completion
44 };
45 ("completionItem/resolve") => {
46 $crate::request::ResolveCompletionItem
47 };
48 ("textDocument/hover") => {
49 $crate::request::HoverRequest
50 };
51 ("textDocument/signatureHelp") => {
52 $crate::request::SignatureHelpRequest
53 };
54 ("textDocument/declaration") => {
55 $crate::request::GotoDeclaration
56 };
57 ("textDocument/definition") => {
58 $crate::request::GotoDefinition
59 };
60 ("textDocument/references") => {
61 $crate::request::References
62 };
63 ("textDocument/documentHighlight") => {
64 $crate::request::DocumentHighlightRequest
65 };
66 ("textDocument/documentSymbol") => {
67 $crate::request::DocumentSymbolRequest
68 };
69 ("textDocument/codeAction") => {
70 $crate::request::CodeActionRequest
71 };
72 ("textDocument/codeLens") => {
73 $crate::request::CodeLensRequest
74 };
75 ("codeLens/resolve") => {
76 $crate::request::CodeLensResolve
77 };
78 ("textDocument/documentLink") => {
79 $crate::request::DocumentLinkRequest
80 };
81 ("documentLink/resolve") => {
82 $crate::request::DocumentLinkResolve
83 };
84 ("workspace/applyEdit") => {
85 $crate::request::ApplyWorkspaceEdit
86 };
87 ("textDocument/rangeFormatting") => {
88 $crate::request::RangeFormatting
89 };
90 ("textDocument/onTypeFormatting") => {
91 $crate::request::OnTypeFormatting
92 };
93 ("textDocument/formatting") => {
94 $crate::request::Formatting
95 };
96 ("textDocument/rename") => {
97 $crate::request::Rename
98 };
99 ("textDocument/documentColor") => {
100 $crate::request::DocumentColor
101 };
102 ("textDocument/colorPresentation") => {
103 $crate::request::ColorPresentationRequest
104 };
105 ("textDocument/foldingRange") => {
106 $crate::request::FoldingRangeRequest
107 };
108 ("textDocument/prepareRename") => {
109 $crate::request::PrepareRenameRequest
110 };
111 ("textDocument/implementation") => {
112 $crate::request::GotoImplementation
113 };
114 ("textDocument/typeDefinition") => {
115 $crate::request::GotoTypeDefinition
116 };
117 ("textDocument/selectionRange") => {
118 $crate::request::SelectionRangeRequest
119 };
120 ("workspace/workspaceFolders") => {
121 $crate::request::WorkspaceFoldersRequest
122 };
123 ("workspace/configuration") => {
124 $crate::request::WorkspaceConfiguration
125 };
126 ("window/workDoneProgress/create") => {
127 $crate::request::WorkDoneProgressCreate
128 };
129 // Requires #[cfg(feature = "proposed")]
130 ("callHierarchy/incomingCalls") => {
131 $crate::request::CallHierarchyIncomingCalls
132 };
133 // Requires #[cfg(feature = "proposed")]
134 ("callHierarchy/outgoingCalls") => {
135 $crate::request::CallHierarchyOutgoingCalls
136 };
137 // Requires #[cfg(feature = "proposed")]
138 ("textDocument/prepareCallHierarchy") => {
139 $crate::request::CallHierarchyPrepare
140 };
141 // Requires #[cfg(feature = "proposed")]
142 ("textDocument/semanticTokens/full") => {
143 $crate::request::SemanticTokensFullRequest
144 };
145 // Requires #[cfg(feature = "proposed")]
146 ("textDocument/semanticTokens/full/delta") => {
147 $crate::request::SemanticTokensFullDeltaRequest
148 };
149 // Requires #[cfg(feature = "proposed")]
150 ("textDocument/semanticTokens/range") => {
151 $crate::request::SemanticTokensRangeRequest
152 };
153 }
154
155 /// The initialize request is sent as the first request from the client to the server.
156 /// If the server receives request or notification before the `initialize` request it should act as follows:
157 ///
158 /// * for a request the respond should be errored with `code: -32001`. The message can be picked by the server.
159 /// * notifications should be dropped.
160 #[derive(Debug)]
161 pub enum Initialize {}
162
163 impl Request for Initialize {
164 type Params = InitializeParams;
165 type Result = InitializeResult;
166 const METHOD: &'static str = "initialize";
167 }
168
169 /// The shutdown request is sent from the client to the server. It asks the server to shut down,
170 /// but to not exit (otherwise the response might not be delivered correctly to the client).
171 /// There is a separate exit notification that asks the server to exit.
172 #[derive(Debug)]
173 pub enum Shutdown {}
174
175 impl Request for Shutdown {
176 type Params = ();
177 type Result = ();
178 const METHOD: &'static str = "shutdown";
179 }
180
181 /// The show message request is sent from a server to a client to ask the client to display a particular message
182 /// in the user interface. In addition to the show message notification the request allows to pass actions and to
183 /// wait for an answer from the client.
184 #[derive(Debug)]
185 pub enum ShowMessageRequest {}
186
187 impl Request for ShowMessageRequest {
188 type Params = ShowMessageRequestParams;
189 type Result = Option<MessageActionItem>;
190 const METHOD: &'static str = "window/showMessageRequest";
191 }
192
193 /// The client/registerCapability request is sent from the server to the client to register for a new capability
194 /// on the client side. Not all clients need to support dynamic capability registration. A client opts in via the
195 /// ClientCapabilities.GenericCapability property.
196 #[derive(Debug)]
197 pub enum RegisterCapability {}
198
199 impl Request for RegisterCapability {
200 type Params = RegistrationParams;
201 type Result = ();
202 const METHOD: &'static str = "client/registerCapability";
203 }
204
205 /// The client/unregisterCapability request is sent from the server to the client to unregister a
206 /// previously register capability.
207 #[derive(Debug)]
208 pub enum UnregisterCapability {}
209
210 impl Request for UnregisterCapability {
211 type Params = UnregistrationParams;
212 type Result = ();
213 const METHOD: &'static str = "client/unregisterCapability";
214 }
215
216 /// The Completion request is sent from the client to the server to compute completion items at a given cursor position.
217 /// Completion items are presented in the IntelliSense user interface. If computing full completion items is expensive,
218 /// servers can additionally provide a handler for the completion item resolve request ('completionItem/resolve').
219 /// This request is sent when a completion item is selected in the user interface. A typical use case is for example:
220 /// the 'textDocument/completion' request doesn’t fill in the documentation property for returned completion items
221 /// since it is expensive to compute. When the item is selected in the user interface then a ‘completionItem/resolve’
222 /// request is sent with the selected completion item as a param. The returned completion item should have the
223 /// documentation property filled in. The request can delay the computation of the detail and documentation properties.
224 /// However, properties that are needed for the initial sorting and filtering, like sortText, filterText, insertText,
225 /// and textEdit must be provided in the textDocument/completion request and must not be changed during resolve.
226 #[derive(Debug)]
227 pub enum Completion {}
228
229 impl Request for Completion {
230 type Params = CompletionParams;
231 type Result = Option<CompletionResponse>;
232 const METHOD: &'static str = "textDocument/completion";
233 }
234
235 /// The request is sent from the client to the server to resolve additional information for a given completion item.
236 #[derive(Debug)]
237 pub enum ResolveCompletionItem {}
238
239 impl Request for ResolveCompletionItem {
240 type Params = CompletionItem;
241 type Result = CompletionItem;
242 const METHOD: &'static str = "completionItem/resolve";
243 }
244
245 /// The hover request is sent from the client to the server to request hover information at a given text
246 /// document position.
247 #[derive(Debug)]
248 pub enum HoverRequest {}
249
250 impl Request for HoverRequest {
251 type Params = HoverParams;
252 type Result = Option<Hover>;
253 const METHOD: &'static str = "textDocument/hover";
254 }
255
256 /// The signature help request is sent from the client to the server to request signature information at
257 /// a given cursor position.
258 #[derive(Debug)]
259 pub enum SignatureHelpRequest {}
260
261 impl Request for SignatureHelpRequest {
262 type Params = SignatureHelpParams;
263 type Result = Option<SignatureHelp>;
264 const METHOD: &'static str = "textDocument/signatureHelp";
265 }
266
267 #[derive(Debug)]
268 pub enum GotoDeclaration {}
269 pub type GotoDeclarationParams = GotoDefinitionParams;
270 pub type GotoDeclarationResponse = GotoDefinitionResponse;
271
272 /// The goto declaration request is sent from the client to the server to resolve the declaration location of
273 /// a symbol at a given text document position.
274 impl Request for GotoDeclaration {
275 type Params = GotoDeclarationParams;
276 type Result = Option<GotoDeclarationResponse>;
277 const METHOD: &'static str = "textDocument/declaration";
278 }
279
280 /// The goto definition request is sent from the client to the server to resolve the definition location of
281 /// a symbol at a given text document position.
282 #[derive(Debug)]
283 pub enum GotoDefinition {}
284
285 impl Request for GotoDefinition {
286 type Params = GotoDefinitionParams;
287 type Result = Option<GotoDefinitionResponse>;
288 const METHOD: &'static str = "textDocument/definition";
289 }
290
291 /// The references request is sent from the client to the server to resolve project-wide references for the
292 /// symbol denoted by the given text document position.
293 #[derive(Debug)]
294 pub enum References {}
295
296 impl Request for References {
297 type Params = ReferenceParams;
298 type Result = Option<Vec<Location>>;
299 const METHOD: &'static str = "textDocument/references";
300 }
301
302 /// The goto type definition request is sent from the client to the
303 /// server to resolve the type definition location of a symbol at a
304 /// given text document position.
305 #[derive(Debug)]
306 pub enum GotoTypeDefinition {}
307
308 pub type GotoTypeDefinitionParams = GotoDefinitionParams;
309 pub type GotoTypeDefinitionResponse = GotoDefinitionResponse;
310
311 impl Request for GotoTypeDefinition {
312 type Params = GotoTypeDefinitionParams;
313 type Result = Option<GotoTypeDefinitionResponse>;
314 const METHOD: &'static str = "textDocument/typeDefinition";
315 }
316
317 /// The goto implementation request is sent from the client to the
318 /// server to resolve the implementation location of a symbol at a
319 /// given text document position.
320 #[derive(Debug)]
321 pub enum GotoImplementation {}
322
323 pub type GotoImplementationParams = GotoTypeDefinitionParams;
324 pub type GotoImplementationResponse = GotoDefinitionResponse;
325
326 impl Request for GotoImplementation {
327 type Params = GotoImplementationParams;
328 type Result = Option<GotoImplementationResponse>;
329 const METHOD: &'static str = "textDocument/implementation";
330 }
331
332 /// The document highlight request is sent from the client to the server to resolve a document highlights
333 /// for a given text document position.
334 /// For programming languages this usually highlights all references to the symbol scoped to this file.
335 /// However we kept 'textDocument/documentHighlight' and 'textDocument/references' separate requests since
336 /// the first one is allowed to be more fuzzy.
337 /// Symbol matches usually have a DocumentHighlightKind of Read or Write whereas fuzzy or textual matches
338 /// use Text as the kind.
339 #[derive(Debug)]
340 pub enum DocumentHighlightRequest {}
341
342 impl Request for DocumentHighlightRequest {
343 type Params = DocumentHighlightParams;
344 type Result = Option<Vec<DocumentHighlight>>;
345 const METHOD: &'static str = "textDocument/documentHighlight";
346 }
347
348 /// The document symbol request is sent from the client to the server to list all symbols found in a given
349 /// text document.
350 #[derive(Debug)]
351 pub enum DocumentSymbolRequest {}
352
353 impl Request for DocumentSymbolRequest {
354 type Params = DocumentSymbolParams;
355 type Result = Option<DocumentSymbolResponse>;
356 const METHOD: &'static str = "textDocument/documentSymbol";
357 }
358
359 /// The workspace symbol request is sent from the client to the server to list project-wide symbols
360 /// matching the query string.
361 #[derive(Debug)]
362 pub enum WorkspaceSymbol {}
363
364 impl Request for WorkspaceSymbol {
365 type Params = WorkspaceSymbolParams;
366 type Result = Option<Vec<SymbolInformation>>;
367 const METHOD: &'static str = "workspace/symbol";
368 }
369
370 /// The workspace/executeCommand request is sent from the client to the server to trigger command execution on the server.
371 /// In most cases the server creates a WorkspaceEdit structure and applies the changes to the workspace using the request
372 /// workspace/applyEdit which is sent from the server to the client.
373 #[derive(Debug)]
374 pub enum ExecuteCommand {}
375
376 impl Request for ExecuteCommand {
377 type Params = ExecuteCommandParams;
378 type Result = Option<Value>;
379 const METHOD: &'static str = "workspace/executeCommand";
380 }
381
382 /// The document will save request is sent from the client to the server before the document is
383 /// actually saved. The request can return an array of TextEdits which will be applied to the text
384 /// document before it is saved. Please note that clients might drop results if computing the text
385 /// edits took too long or if a server constantly fails on this request. This is done to keep the
386 /// save fast and reliable.
387 #[derive(Debug)]
388 pub enum WillSaveWaitUntil {}
389
390 impl Request for WillSaveWaitUntil {
391 type Params = WillSaveTextDocumentParams;
392 type Result = Option<Vec<TextEdit>>;
393 const METHOD: &'static str = "textDocument/willSaveWaitUntil";
394 }
395
396 /// The workspace/applyEdit request is sent from the server to the client to modify resource on the
397 /// client side.
398 #[derive(Debug)]
399 pub enum ApplyWorkspaceEdit {}
400
401 impl Request for ApplyWorkspaceEdit {
402 type Params = ApplyWorkspaceEditParams;
403 type Result = ApplyWorkspaceEditResponse;
404 const METHOD: &'static str = "workspace/applyEdit";
405 }
406
407 /// The workspace/configuration request is sent from the server to the client to fetch configuration settings
408 /// from the client. The request can fetch several configuration settings in one roundtrip.
409 /// The order of the returned configuration settings correspond to the order of the passed ConfigurationItems
410 /// (e.g. the first item in the response is the result for the first configuration item in the params).
411 ///
412 /// A ConfigurationItem consists of the configuration section to ask for and an additional scope URI.
413 /// The configuration section ask for is defined by the server and doesn’t necessarily need to correspond to
414 /// the configuration store used be the client. So a server might ask for a configuration cpp.formatterOptions
415 /// but the client stores the configuration in a XML store layout differently.
416 /// It is up to the client to do the necessary conversion. If a scope URI is provided the client should return
417 /// the setting scoped to the provided resource. If the client for example uses EditorConfig to manage its
418 /// settings the configuration should be returned for the passed resource URI. If the client can’t provide a
419 /// configuration setting for a given scope then null need to be present in the returned array.
420 #[derive(Debug)]
421 pub enum WorkspaceConfiguration {}
422
423 impl Request for WorkspaceConfiguration {
424 type Params = ConfigurationParams;
425 type Result = Vec<Value>;
426 const METHOD: &'static str = "workspace/configuration";
427 }
428
429 /// The code action request is sent from the client to the server to compute commands for a given text document
430 /// and range. The request is triggered when the user moves the cursor into a problem marker in the editor or
431 /// presses the lightbulb associated with a marker.
432 #[derive(Debug)]
433 pub enum CodeActionRequest {}
434
435 impl Request for CodeActionRequest {
436 type Params = CodeActionParams;
437 type Result = Option<CodeActionResponse>;
438 const METHOD: &'static str = "textDocument/codeAction";
439 }
440
441 /// The code lens request is sent from the client to the server to compute code lenses for a given text document.
442 #[derive(Debug)]
443 pub enum CodeLensRequest {}
444
445 impl Request for CodeLensRequest {
446 type Params = CodeLensParams;
447 type Result = Option<Vec<CodeLens>>;
448 const METHOD: &'static str = "textDocument/codeLens";
449 }
450
451 /// The code lens resolve request is sent from the client to the server to resolve the command for a
452 /// given code lens item.
453 #[derive(Debug)]
454 pub enum CodeLensResolve {}
455
456 impl Request for CodeLensResolve {
457 type Params = CodeLens;
458 type Result = CodeLens;
459 const METHOD: &'static str = "codeLens/resolve";
460 }
461
462 /// The document links request is sent from the client to the server to request the location of links in a document.
463 #[derive(Debug)]
464 pub enum DocumentLinkRequest {}
465
466 impl Request for DocumentLinkRequest {
467 type Params = DocumentLinkParams;
468 type Result = Option<Vec<DocumentLink>>;
469 const METHOD: &'static str = "textDocument/documentLink";
470 }
471
472 /// The document link resolve request is sent from the client to the server to resolve the target of
473 /// a given document link.
474 #[derive(Debug)]
475 pub enum DocumentLinkResolve {}
476
477 impl Request for DocumentLinkResolve {
478 type Params = DocumentLink;
479 type Result = DocumentLink;
480 const METHOD: &'static str = "documentLink/resolve";
481 }
482
483 /// The document formatting request is sent from the server to the client to format a whole document.
484 #[derive(Debug)]
485 pub enum Formatting {}
486
487 impl Request for Formatting {
488 type Params = DocumentFormattingParams;
489 type Result = Option<Vec<TextEdit>>;
490 const METHOD: &'static str = "textDocument/formatting";
491 }
492
493 /// The document range formatting request is sent from the client to the server to format a given range in a document.
494 #[derive(Debug)]
495 pub enum RangeFormatting {}
496
497 impl Request for RangeFormatting {
498 type Params = DocumentRangeFormattingParams;
499 type Result = Option<Vec<TextEdit>>;
500 const METHOD: &'static str = "textDocument/rangeFormatting";
501 }
502
503 /// The document on type formatting request is sent from the client to the server to format parts of
504 /// the document during typing.
505 #[derive(Debug)]
506 pub enum OnTypeFormatting {}
507
508 impl Request for OnTypeFormatting {
509 type Params = DocumentOnTypeFormattingParams;
510 type Result = Option<Vec<TextEdit>>;
511 const METHOD: &'static str = "textDocument/onTypeFormatting";
512 }
513
514 /// The rename request is sent from the client to the server to perform a workspace-wide rename of a symbol.
515 #[derive(Debug)]
516 pub enum Rename {}
517
518 impl Request for Rename {
519 type Params = RenameParams;
520 type Result = Option<WorkspaceEdit>;
521 const METHOD: &'static str = "textDocument/rename";
522 }
523
524 /// The document color request is sent from the client to the server to list all color references found in a given text document.
525 /// Along with the range, a color value in RGB is returned.
526 #[derive(Debug)]
527 pub enum DocumentColor {}
528
529 impl Request for DocumentColor {
530 type Params = DocumentColorParams;
531 type Result = Vec<ColorInformation>;
532 const METHOD: &'static str = "textDocument/documentColor";
533 }
534
535 /// The color presentation request is sent from the client to the server to obtain a list of presentations for a color value
536 /// at a given location.
537 #[derive(Debug)]
538 pub enum ColorPresentationRequest {}
539
540 impl Request for ColorPresentationRequest {
541 type Params = ColorPresentationParams;
542 type Result = Vec<ColorPresentation>;
543 const METHOD: &'static str = "textDocument/colorPresentation";
544 }
545
546 /// The folding range request is sent from the client to the server to return all folding ranges found in a given text document.
547 #[derive(Debug)]
548 pub enum FoldingRangeRequest {}
549
550 impl Request for FoldingRangeRequest {
551 type Params = FoldingRangeParams;
552 type Result = Option<Vec<FoldingRange>>;
553 const METHOD: &'static str = "textDocument/foldingRange";
554 }
555
556 /// The prepare rename request is sent from the client to the server to setup and test the validity of a rename operation
557 /// at a given location.
558 #[derive(Debug)]
559 pub enum PrepareRenameRequest {}
560
561 impl Request for PrepareRenameRequest {
562 type Params = TextDocumentPositionParams;
563 type Result = Option<PrepareRenameResponse>;
564 const METHOD: &'static str = "textDocument/prepareRename";
565 }
566
567 /// The workspace/workspaceFolders request is sent from the server to the client to fetch the current open list of
568 /// workspace folders. Returns null in the response if only a single file is open in the tool.
569 /// Returns an empty array if a workspace is open but no folders are configured.
570 #[derive(Debug)]
571 pub enum WorkspaceFoldersRequest {}
572
573 impl Request for WorkspaceFoldersRequest {
574 type Params = ();
575 type Result = Option<Vec<WorkspaceFolder>>;
576 const METHOD: &'static str = "workspace/workspaceFolders";
577 }
578
579 /// The `window/workDoneProgress/create` request is sent from the server
580 /// to the clientto ask the client to create a work done progress.
581 #[derive(Debug)]
582 pub enum WorkDoneProgressCreate {}
583
584 impl Request for WorkDoneProgressCreate {
585 type Params = WorkDoneProgressCreateParams;
586 type Result = ();
587 const METHOD: &'static str = "window/workDoneProgress/create";
588 }
589
590 /// The selection range request is sent from the client to the server to return
591 /// suggested selection ranges at given positions. A selection range is a range
592 /// around the cursor position which the user might be interested in selecting.
593 ///
594 /// A selection range in the return array is for the position in the provided parameters at the same index.
595 /// Therefore positions[i] must be contained in result[i].range.
596 ///
597 /// Typically, but not necessary, selection ranges correspond to the nodes of the
598 /// syntax tree.
599 pub enum SelectionRangeRequest {}
600
601 impl Request for SelectionRangeRequest {
602 type Params = SelectionRangeParams;
603 type Result = Option<Vec<SelectionRange>>;
604 const METHOD: &'static str = "textDocument/selectionRange";
605 }
606
607 #[cfg(feature = "proposed")]
608 pub enum CallHierarchyPrepare {}
609
610 #[cfg(feature = "proposed")]
611 impl Request for CallHierarchyPrepare {
612 type Params = CallHierarchyPrepareParams;
613 type Result = Option<Vec<CallHierarchyItem>>;
614 const METHOD: &'static str = "textDocument/prepareCallHierarchy";
615 }
616
617 #[cfg(feature = "proposed")]
618 pub enum CallHierarchyIncomingCalls {}
619
620 #[cfg(feature = "proposed")]
621 impl Request for CallHierarchyIncomingCalls {
622 type Params = CallHierarchyIncomingCallsParams;
623 type Result = Option<Vec<CallHierarchyIncomingCall>>;
624 const METHOD: &'static str = "callHierarchy/incomingCalls";
625 }
626
627 #[cfg(feature = "proposed")]
628 pub enum CallHierarchyOutgoingCalls {}
629
630 #[cfg(feature = "proposed")]
631 impl Request for CallHierarchyOutgoingCalls {
632 type Params = CallHierarchyOutgoingCallsParams;
633 type Result = Option<Vec<CallHierarchyOutgoingCall>>;
634 const METHOD: &'static str = "callHierarchy/outgoingCalls";
635 }
636
637 #[cfg(feature = "proposed")]
638 pub enum SemanticTokensFullRequest {}
639
640 #[cfg(feature = "proposed")]
641 impl Request for SemanticTokensFullRequest {
642 type Params = SemanticTokensParams;
643 type Result = Option<SemanticTokensResult>;
644 const METHOD: &'static str = "textDocument/semanticTokens/full";
645 }
646
647 #[cfg(feature = "proposed")]
648 pub enum SemanticTokensFullDeltaRequest {}
649
650 #[cfg(feature = "proposed")]
651 impl Request for SemanticTokensFullDeltaRequest {
652 type Params = SemanticTokensDeltaParams;
653 type Result = Option<SemanticTokensFullDeltaResult>;
654 const METHOD: &'static str = "textDocument/semanticTokens/full/delta";
655 }
656
657 #[cfg(feature = "proposed")]
658 pub enum SemanticTokensRangeRequest {}
659
660 #[cfg(feature = "proposed")]
661 impl Request for SemanticTokensRangeRequest {
662 type Params = SemanticTokensRangeParams;
663 type Result = Option<SemanticTokensRangeResult>;
664 const METHOD: &'static str = "textDocument/semanticTokens/range";
665 }
666
667 #[cfg(test)]
668 mod test {
669 use super::*;
670
671 fn fake_call<R>()
672 where
673 R: Request,
674 R::Params: serde::Serialize,
675 R::Result: serde::de::DeserializeOwned,
676 {
677 }
678
679 macro_rules! check_macro {
680 ($name:tt) => {
681 // check whethe the macro name matches the method
682 assert_eq!(<lsp_request!($name) as Request>::METHOD, $name);
683 // test whether type checking passes for each component
684 fake_call::<lsp_request!($name)>();
685 };
686 }
687
688 #[test]
689 fn check_macro_definitions() {
690 check_macro!("initialize");
691 check_macro!("shutdown");
692 check_macro!("window/showMessageRequest");
693 check_macro!("window/workDoneProgress/create");
694 check_macro!("client/registerCapability");
695 check_macro!("client/unregisterCapability");
696 check_macro!("workspace/symbol");
697 check_macro!("workspace/executeCommand");
698 check_macro!("textDocument/willSaveWaitUntil");
699 check_macro!("textDocument/completion");
700 check_macro!("completionItem/resolve");
701 check_macro!("textDocument/hover");
702 check_macro!("textDocument/signatureHelp");
703 check_macro!("textDocument/declaration");
704 check_macro!("textDocument/definition");
705 check_macro!("textDocument/references");
706 check_macro!("textDocument/documentHighlight");
707 check_macro!("textDocument/documentSymbol");
708 check_macro!("textDocument/codeAction");
709 check_macro!("textDocument/codeLens");
710 check_macro!("codeLens/resolve");
711 check_macro!("textDocument/documentLink");
712 check_macro!("documentLink/resolve");
713 check_macro!("workspace/applyEdit");
714 check_macro!("textDocument/rangeFormatting");
715 check_macro!("textDocument/onTypeFormatting");
716 check_macro!("textDocument/formatting");
717 check_macro!("textDocument/rename");
718 check_macro!("textDocument/documentColor");
719 check_macro!("textDocument/colorPresentation");
720 check_macro!("textDocument/foldingRange");
721 check_macro!("textDocument/prepareRename");
722 check_macro!("workspace/workspaceFolders");
723 check_macro!("textDocument/implementation");
724 check_macro!("textDocument/selectionRange");
725 check_macro!("textDocument/typeDefinition");
726 check_macro!("workspace/configuration");
727 }
728
729 #[test]
730 #[cfg(feature = "proposed")]
731 fn check_proposed_macro_definitions() {
732 check_macro!("callHierarchy/incomingCalls");
733 check_macro!("callHierarchy/outgoingCalls");
734 check_macro!("textDocument/prepareCallHierarchy");
735 check_macro!("textDocument/semanticTokens/full");
736 check_macro!("textDocument/semanticTokens/full/delta");
737 check_macro!("textDocument/semanticTokens/range");
738 }
739 }