1use super::*;
23use serde::{de::DeserializeOwned, Serialize};
45pub trait Request {
6type Params: DeserializeOwned + Serialize;
7type Result: DeserializeOwned + Serialize;
8const METHOD: &'static str;
9}
1011#[macro_export]
12macro_rules! lsp_request {
13 ("initialize") => {
14$crate::request::Initialize
15};
16 ("shutdown") => {
17$crate::request::Shutdown
18};
1920 ("window/showMessageRequest") => {
21$crate::request::ShowMessageRequest
22};
2324 ("client/registerCapability") => {
25$crate::request::RegisterCapability
26};
27 ("client/unregisterCapability") => {
28$crate::request::UnregisterCapability
29};
3031 ("workspace/symbol") => {
32$crate::request::WorkspaceSymbolRequest
33};
34 ("workspaceSymbol/resolve") => {
35$crate::request::WorkspaceSymbolResolve
36};
37 ("workspace/executeCommand") => {
38$crate::request::ExecuteCommand
39};
4041 ("textDocument/willSaveWaitUntil") => {
42$crate::request::WillSaveWaitUntil
43};
4445 ("textDocument/completion") => {
46$crate::request::Completion
47};
48 ("completionItem/resolve") => {
49$crate::request::ResolveCompletionItem
50};
51 ("textDocument/hover") => {
52$crate::request::HoverRequest
53};
54 ("textDocument/signatureHelp") => {
55$crate::request::SignatureHelpRequest
56};
57 ("textDocument/declaration") => {
58$crate::request::GotoDeclaration
59};
60 ("textDocument/definition") => {
61$crate::request::GotoDefinition
62};
63 ("textDocument/references") => {
64$crate::request::References
65};
66 ("textDocument/documentHighlight") => {
67$crate::request::DocumentHighlightRequest
68};
69 ("textDocument/documentSymbol") => {
70$crate::request::DocumentSymbolRequest
71};
72 ("textDocument/codeAction") => {
73$crate::request::CodeActionRequest
74};
75 ("textDocument/codeLens") => {
76$crate::request::CodeLensRequest
77};
78 ("codeLens/resolve") => {
79$crate::request::CodeLensResolve
80};
81 ("textDocument/documentLink") => {
82$crate::request::DocumentLinkRequest
83};
84 ("documentLink/resolve") => {
85$crate::request::DocumentLinkResolve
86};
87 ("workspace/applyEdit") => {
88$crate::request::ApplyWorkspaceEdit
89};
90 ("textDocument/rangeFormatting") => {
91$crate::request::RangeFormatting
92};
93 ("textDocument/onTypeFormatting") => {
94$crate::request::OnTypeFormatting
95};
96 ("textDocument/formatting") => {
97$crate::request::Formatting
98};
99 ("textDocument/rename") => {
100$crate::request::Rename
101};
102 ("textDocument/documentColor") => {
103$crate::request::DocumentColor
104};
105 ("textDocument/colorPresentation") => {
106$crate::request::ColorPresentationRequest
107};
108 ("textDocument/foldingRange") => {
109$crate::request::FoldingRangeRequest
110};
111 ("textDocument/prepareRename") => {
112$crate::request::PrepareRenameRequest
113};
114 ("textDocument/implementation") => {
115$crate::request::GotoImplementation
116};
117 ("textDocument/typeDefinition") => {
118$crate::request::GotoTypeDefinition
119};
120 ("textDocument/selectionRange") => {
121$crate::request::SelectionRangeRequest
122};
123 ("workspace/workspaceFolders") => {
124$crate::request::WorkspaceFoldersRequest
125};
126 ("workspace/configuration") => {
127$crate::request::WorkspaceConfiguration
128};
129 ("window/workDoneProgress/create") => {
130$crate::request::WorkDoneProgressCreate
131};
132 ("callHierarchy/incomingCalls") => {
133$crate::request::CallHierarchyIncomingCalls
134};
135 ("callHierarchy/outgoingCalls") => {
136$crate::request::CallHierarchyOutgoingCalls
137};
138 ("textDocument/moniker") => {
139$crate::request::MonikerRequest
140};
141 ("textDocument/linkedEditingRange") => {
142$crate::request::LinkedEditingRange
143};
144 ("textDocument/prepareCallHierarchy") => {
145$crate::request::CallHierarchyPrepare
146};
147 ("textDocument/prepareTypeHierarchy") => {
148$crate::request::TypeHierarchyPrepare
149};
150 ("textDocument/semanticTokens/full") => {
151$crate::request::SemanticTokensFullRequest
152};
153 ("textDocument/semanticTokens/full/delta") => {
154$crate::request::SemanticTokensFullDeltaRequest
155};
156 ("textDocument/semanticTokens/range") => {
157$crate::request::SemanticTokensRangeRequest
158};
159 ("textDocument/inlayHint") => {
160$crate::request::InlayHintRequest
161};
162 ("textDocument/inlineValue") => {
163$crate::request::InlineValueRequest
164};
165 ("textDocument/diagnostic") => {
166$crate::request::DocumentDiagnosticRequest
167};
168 ("workspace/diagnostic") => {
169$crate::request::WorkspaceDiagnosticRequest
170};
171 ("workspace/diagnostic/refresh") => {
172$crate::request::WorkspaceDiagnosticRefresh
173};
174 ("typeHierarchy/supertypes") => {
175$crate::request::TypeHierarchySupertypes
176};
177 ("typeHierarchy/subtypes") => {
178$crate::request::TypeHierarchySubtypes
179};
180 ("workspace/willCreateFiles") => {
181$crate::request::WillCreateFiles
182};
183 ("workspace/willRenameFiles") => {
184$crate::request::WillRenameFiles
185};
186 ("workspace/willDeleteFiles") => {
187$crate::request::WillDeleteFiles
188};
189 ("workspace/semanticTokens/refresh") => {
190$crate::request::SemanticTokensRefresh
191};
192 ("workspace/codeLens/refresh") => {
193$crate::request::CodeLensRefresh
194};
195 ("workspace/inlayHint/refresh") => {
196$crate::request::InlayHintRefreshRequest
197};
198 ("workspace/inlineValue/refresh") => {
199$crate::request::InlineValueRefreshRequest
200};
201 ("codeAction/resolve") => {
202$crate::request::CodeActionResolveRequest
203};
204 ("inlayHint/resolve") => {
205$crate::request::InlayHintResolveRequest
206};
207 ("window/showDocument") => {
208$crate::request::ShowDocument
209};
210}
211212/// The initialize request is sent as the first request from the client to the server.
213/// If the server receives request or notification before the `initialize` request it should act as follows:
214///
215/// * for a request the respond should be errored with `code: -32001`. The message can be picked by the server.
216/// * notifications should be dropped.
217#[derive(Debug)]
218pub enum Initialize {}
219220impl Request for Initialize {
221type Params = InitializeParams;
222type Result = InitializeResult;
223const METHOD: &'static str = "initialize";
224}
225226/// The shutdown request is sent from the client to the server. It asks the server to shut down,
227/// but to not exit (otherwise the response might not be delivered correctly to the client).
228/// There is a separate exit notification that asks the server to exit.
229#[derive(Debug)]
230pub enum Shutdown {}
231232impl Request for Shutdown {
233type Params = ();
234type Result = ();
235const METHOD: &'static str = "shutdown";
236}
237238/// The show message request is sent from a server to a client to ask the client to display a particular message
239/// in the user interface. In addition to the show message notification the request allows to pass actions and to
240/// wait for an answer from the client.
241#[derive(Debug)]
242pub enum ShowMessageRequest {}
243244impl Request for ShowMessageRequest {
245type Params = ShowMessageRequestParams;
246type Result = Option<MessageActionItem>;
247const METHOD: &'static str = "window/showMessageRequest";
248}
249250/// The client/registerCapability request is sent from the server to the client to register for a new capability
251/// on the client side. Not all clients need to support dynamic capability registration. A client opts in via the
252/// ClientCapabilities.GenericCapability property.
253#[derive(Debug)]
254pub enum RegisterCapability {}
255256impl Request for RegisterCapability {
257type Params = RegistrationParams;
258type Result = ();
259const METHOD: &'static str = "client/registerCapability";
260}
261262/// The client/unregisterCapability request is sent from the server to the client to unregister a
263/// previously register capability.
264#[derive(Debug)]
265pub enum UnregisterCapability {}
266267impl Request for UnregisterCapability {
268type Params = UnregistrationParams;
269type Result = ();
270const METHOD: &'static str = "client/unregisterCapability";
271}
272273/// The Completion request is sent from the client to the server to compute completion items at a given cursor position.
274/// Completion items are presented in the IntelliSense user interface. If computing full completion items is expensive,
275/// servers can additionally provide a handler for the completion item resolve request ('completionItem/resolve').
276/// This request is sent when a completion item is selected in the user interface. A typical use case is for example:
277/// the 'textDocument/completion' request doesn’t fill in the documentation property for returned completion items
278/// since it is expensive to compute. When the item is selected in the user interface then a ‘completionItem/resolve’
279/// request is sent with the selected completion item as a param. The returned completion item should have the
280/// documentation property filled in. The request can delay the computation of the detail and documentation properties.
281/// However, properties that are needed for the initial sorting and filtering, like sortText, filterText, insertText,
282/// and textEdit must be provided in the textDocument/completion request and must not be changed during resolve.
283#[derive(Debug)]
284pub enum Completion {}
285286impl Request for Completion {
287type Params = CompletionParams;
288type Result = Option<CompletionResponse>;
289const METHOD: &'static str = "textDocument/completion";
290}
291292/// The request is sent from the client to the server to resolve additional information for a given completion item.
293#[derive(Debug)]
294pub enum ResolveCompletionItem {}
295296impl Request for ResolveCompletionItem {
297type Params = CompletionItem;
298type Result = CompletionItem;
299const METHOD: &'static str = "completionItem/resolve";
300}
301302/// The hover request is sent from the client to the server to request hover information at a given text
303/// document position.
304#[derive(Debug)]
305pub enum HoverRequest {}
306307impl Request for HoverRequest {
308type Params = HoverParams;
309type Result = Option<Hover>;
310const METHOD: &'static str = "textDocument/hover";
311}
312313/// The signature help request is sent from the client to the server to request signature information at
314/// a given cursor position.
315#[derive(Debug)]
316pub enum SignatureHelpRequest {}
317318impl Request for SignatureHelpRequest {
319type Params = SignatureHelpParams;
320type Result = Option<SignatureHelp>;
321const METHOD: &'static str = "textDocument/signatureHelp";
322}
323324#[derive(Debug)]
325pub enum GotoDeclaration {}
326pub type GotoDeclarationParams = GotoDefinitionParams;
327pub type GotoDeclarationResponse = GotoDefinitionResponse;
328329/// The goto declaration request is sent from the client to the server to resolve the declaration location of
330/// a symbol at a given text document position.
331impl Request for GotoDeclaration {
332type Params = GotoDeclarationParams;
333type Result = Option<GotoDeclarationResponse>;
334const METHOD: &'static str = "textDocument/declaration";
335}
336337/// The goto definition request is sent from the client to the server to resolve the definition location of
338/// a symbol at a given text document position.
339#[derive(Debug)]
340pub enum GotoDefinition {}
341342impl Request for GotoDefinition {
343type Params = GotoDefinitionParams;
344type Result = Option<GotoDefinitionResponse>;
345const METHOD: &'static str = "textDocument/definition";
346}
347348/// The references request is sent from the client to the server to resolve project-wide references for the
349/// symbol denoted by the given text document position.
350#[derive(Debug)]
351pub enum References {}
352353impl Request for References {
354type Params = ReferenceParams;
355type Result = Option<Vec<Location>>;
356const METHOD: &'static str = "textDocument/references";
357}
358359/// The goto type definition request is sent from the client to the
360/// server to resolve the type definition location of a symbol at a
361/// given text document position.
362#[derive(Debug)]
363pub enum GotoTypeDefinition {}
364365pub type GotoTypeDefinitionParams = GotoDefinitionParams;
366pub type GotoTypeDefinitionResponse = GotoDefinitionResponse;
367368impl Request for GotoTypeDefinition {
369type Params = GotoTypeDefinitionParams;
370type Result = Option<GotoTypeDefinitionResponse>;
371const METHOD: &'static str = "textDocument/typeDefinition";
372}
373374/// The goto implementation request is sent from the client to the
375/// server to resolve the implementation location of a symbol at a
376/// given text document position.
377#[derive(Debug)]
378pub enum GotoImplementation {}
379380pub type GotoImplementationParams = GotoTypeDefinitionParams;
381pub type GotoImplementationResponse = GotoDefinitionResponse;
382383impl Request for GotoImplementation {
384type Params = GotoImplementationParams;
385type Result = Option<GotoImplementationResponse>;
386const METHOD: &'static str = "textDocument/implementation";
387}
388389/// The document highlight request is sent from the client to the server to resolve a document highlights
390/// for a given text document position.
391/// For programming languages this usually highlights all references to the symbol scoped to this file.
392/// However we kept 'textDocument/documentHighlight' and 'textDocument/references' separate requests since
393/// the first one is allowed to be more fuzzy.
394/// Symbol matches usually have a DocumentHighlightKind of Read or Write whereas fuzzy or textual matches
395/// use Text as the kind.
396#[derive(Debug)]
397pub enum DocumentHighlightRequest {}
398399impl Request for DocumentHighlightRequest {
400type Params = DocumentHighlightParams;
401type Result = Option<Vec<DocumentHighlight>>;
402const METHOD: &'static str = "textDocument/documentHighlight";
403}
404405/// The document symbol request is sent from the client to the server to list all symbols found in a given
406/// text document.
407#[derive(Debug)]
408pub enum DocumentSymbolRequest {}
409410impl Request for DocumentSymbolRequest {
411type Params = DocumentSymbolParams;
412type Result = Option<DocumentSymbolResponse>;
413const METHOD: &'static str = "textDocument/documentSymbol";
414}
415416/// The workspace symbol request is sent from the client to the server to list project-wide symbols
417/// matching the query string.
418#[derive(Debug)]
419pub enum WorkspaceSymbolRequest {}
420421impl Request for WorkspaceSymbolRequest {
422type Params = WorkspaceSymbolParams;
423type Result = Option<WorkspaceSymbolResponse>;
424const METHOD: &'static str = "workspace/symbol";
425}
426427/// The `workspaceSymbol/resolve` request is sent from the client to the server to resolve
428/// additional information for a given workspace symbol.
429#[derive(Debug)]
430pub enum WorkspaceSymbolResolve {}
431432impl Request for WorkspaceSymbolResolve {
433type Params = WorkspaceSymbol;
434type Result = WorkspaceSymbol;
435const METHOD: &'static str = "workspaceSymbol/resolve";
436}
437438/// The workspace/executeCommand request is sent from the client to the server to trigger command execution on the server.
439/// In most cases the server creates a WorkspaceEdit structure and applies the changes to the workspace using the request
440/// workspace/applyEdit which is sent from the server to the client.
441#[derive(Debug)]
442pub enum ExecuteCommand {}
443444impl Request for ExecuteCommand {
445type Params = ExecuteCommandParams;
446type Result = Option<Value>;
447const METHOD: &'static str = "workspace/executeCommand";
448}
449450/// The document will save request is sent from the client to the server before the document is
451/// actually saved. The request can return an array of TextEdits which will be applied to the text
452/// document before it is saved. Please note that clients might drop results if computing the text
453/// edits took too long or if a server constantly fails on this request. This is done to keep the
454/// save fast and reliable.
455#[derive(Debug)]
456pub enum WillSaveWaitUntil {}
457458impl Request for WillSaveWaitUntil {
459type Params = WillSaveTextDocumentParams;
460type Result = Option<Vec<TextEdit>>;
461const METHOD: &'static str = "textDocument/willSaveWaitUntil";
462}
463464/// The workspace/applyEdit request is sent from the server to the client to modify resource on the
465/// client side.
466#[derive(Debug)]
467pub enum ApplyWorkspaceEdit {}
468469impl Request for ApplyWorkspaceEdit {
470type Params = ApplyWorkspaceEditParams;
471type Result = ApplyWorkspaceEditResponse;
472const METHOD: &'static str = "workspace/applyEdit";
473}
474475/// The workspace/configuration request is sent from the server to the client to fetch configuration settings
476/// from the client. The request can fetch several configuration settings in one roundtrip.
477/// The order of the returned configuration settings correspond to the order of the passed ConfigurationItems
478/// (e.g. the first item in the response is the result for the first configuration item in the params).
479///
480/// A ConfigurationItem consists of the configuration section to ask for and an additional scope URI.
481/// The configuration section ask for is defined by the server and doesn’t necessarily need to correspond to
482/// the configuration store used be the client. So a server might ask for a configuration cpp.formatterOptions
483/// but the client stores the configuration in a XML store layout differently.
484/// It is up to the client to do the necessary conversion. If a scope URI is provided the client should return
485/// the setting scoped to the provided resource. If the client for example uses EditorConfig to manage its
486/// settings the configuration should be returned for the passed resource URI. If the client can’t provide a
487/// configuration setting for a given scope then null need to be present in the returned array.
488#[derive(Debug)]
489pub enum WorkspaceConfiguration {}
490491impl Request for WorkspaceConfiguration {
492type Params = ConfigurationParams;
493type Result = Vec<Value>;
494const METHOD: &'static str = "workspace/configuration";
495}
496497/// The code action request is sent from the client to the server to compute commands for a given text document
498/// and range. The request is triggered when the user moves the cursor into a problem marker in the editor or
499/// presses the lightbulb associated with a marker.
500#[derive(Debug)]
501pub enum CodeActionRequest {}
502503impl Request for CodeActionRequest {
504type Params = CodeActionParams;
505type Result = Option<CodeActionResponse>;
506const METHOD: &'static str = "textDocument/codeAction";
507}
508509/// The request is sent from the client to the server to resolve additional information for a given code action.
510/// This is usually used to compute the `edit` property of a code action to avoid its unnecessary computation
511/// during the `textDocument/codeAction` request.
512///
513/// @since 3.16.0
514#[derive(Debug)]
515pub enum CodeActionResolveRequest {}
516517impl Request for CodeActionResolveRequest {
518type Params = CodeAction;
519type Result = CodeAction;
520const METHOD: &'static str = "codeAction/resolve";
521}
522523/// The code lens request is sent from the client to the server to compute code lenses for a given text document.
524#[derive(Debug)]
525pub enum CodeLensRequest {}
526527impl Request for CodeLensRequest {
528type Params = CodeLensParams;
529type Result = Option<Vec<CodeLens>>;
530const METHOD: &'static str = "textDocument/codeLens";
531}
532533/// The code lens resolve request is sent from the client to the server to resolve the command for a
534/// given code lens item.
535#[derive(Debug)]
536pub enum CodeLensResolve {}
537538impl Request for CodeLensResolve {
539type Params = CodeLens;
540type Result = CodeLens;
541const METHOD: &'static str = "codeLens/resolve";
542}
543544/// The document links request is sent from the client to the server to request the location of links in a document.
545#[derive(Debug)]
546pub enum DocumentLinkRequest {}
547548impl Request for DocumentLinkRequest {
549type Params = DocumentLinkParams;
550type Result = Option<Vec<DocumentLink>>;
551const METHOD: &'static str = "textDocument/documentLink";
552}
553554/// The document link resolve request is sent from the client to the server to resolve the target of
555/// a given document link.
556#[derive(Debug)]
557pub enum DocumentLinkResolve {}
558559impl Request for DocumentLinkResolve {
560type Params = DocumentLink;
561type Result = DocumentLink;
562const METHOD: &'static str = "documentLink/resolve";
563}
564565/// The document formatting request is sent from the server to the client to format a whole document.
566#[derive(Debug)]
567pub enum Formatting {}
568569impl Request for Formatting {
570type Params = DocumentFormattingParams;
571type Result = Option<Vec<TextEdit>>;
572const METHOD: &'static str = "textDocument/formatting";
573}
574575/// The document range formatting request is sent from the client to the server to format a given range in a document.
576#[derive(Debug)]
577pub enum RangeFormatting {}
578579impl Request for RangeFormatting {
580type Params = DocumentRangeFormattingParams;
581type Result = Option<Vec<TextEdit>>;
582const METHOD: &'static str = "textDocument/rangeFormatting";
583}
584585/// The document on type formatting request is sent from the client to the server to format parts of
586/// the document during typing.
587#[derive(Debug)]
588pub enum OnTypeFormatting {}
589590impl Request for OnTypeFormatting {
591type Params = DocumentOnTypeFormattingParams;
592type Result = Option<Vec<TextEdit>>;
593const METHOD: &'static str = "textDocument/onTypeFormatting";
594}
595596/// The linked editing request is sent from the client to the server to return for a given position in a document
597/// the range of the symbol at the position and all ranges that have the same content.
598/// Optionally a word pattern can be returned to describe valid contents. A rename to one of the ranges can be applied
599/// to all other ranges if the new content is valid. If no result-specific word pattern is provided, the word pattern from
600/// the client’s language configuration is used.
601#[derive(Debug)]
602pub enum LinkedEditingRange {}
603604impl Request for LinkedEditingRange {
605type Params = LinkedEditingRangeParams;
606type Result = Option<LinkedEditingRanges>;
607const METHOD: &'static str = "textDocument/linkedEditingRange";
608}
609610/// The rename request is sent from the client to the server to perform a workspace-wide rename of a symbol.
611#[derive(Debug)]
612pub enum Rename {}
613614impl Request for Rename {
615type Params = RenameParams;
616type Result = Option<WorkspaceEdit>;
617const METHOD: &'static str = "textDocument/rename";
618}
619620/// The document color request is sent from the client to the server to list all color references found in a given text document.
621/// Along with the range, a color value in RGB is returned.
622#[derive(Debug)]
623pub enum DocumentColor {}
624625impl Request for DocumentColor {
626type Params = DocumentColorParams;
627type Result = Vec<ColorInformation>;
628const METHOD: &'static str = "textDocument/documentColor";
629}
630631/// The color presentation request is sent from the client to the server to obtain a list of presentations for a color value
632/// at a given location.
633#[derive(Debug)]
634pub enum ColorPresentationRequest {}
635636impl Request for ColorPresentationRequest {
637type Params = ColorPresentationParams;
638type Result = Vec<ColorPresentation>;
639const METHOD: &'static str = "textDocument/colorPresentation";
640}
641642/// The folding range request is sent from the client to the server to return all folding ranges found in a given text document.
643#[derive(Debug)]
644pub enum FoldingRangeRequest {}
645646impl Request for FoldingRangeRequest {
647type Params = FoldingRangeParams;
648type Result = Option<Vec<FoldingRange>>;
649const METHOD: &'static str = "textDocument/foldingRange";
650}
651652/// The prepare rename request is sent from the client to the server to setup and test the validity of a rename operation
653/// at a given location.
654#[derive(Debug)]
655pub enum PrepareRenameRequest {}
656657impl Request for PrepareRenameRequest {
658type Params = TextDocumentPositionParams;
659type Result = Option<PrepareRenameResponse>;
660const METHOD: &'static str = "textDocument/prepareRename";
661}
662663/// The workspace/workspaceFolders request is sent from the server to the client to fetch the current open list of
664/// workspace folders. Returns null in the response if only a single file is open in the tool.
665/// Returns an empty array if a workspace is open but no folders are configured.
666#[derive(Debug)]
667pub enum WorkspaceFoldersRequest {}
668669impl Request for WorkspaceFoldersRequest {
670type Params = ();
671type Result = Option<Vec<WorkspaceFolder>>;
672const METHOD: &'static str = "workspace/workspaceFolders";
673}
674675/// The `window/workDoneProgress/create` request is sent from the server
676/// to the client to ask the client to create a work done progress.
677#[derive(Debug)]
678pub enum WorkDoneProgressCreate {}
679680impl Request for WorkDoneProgressCreate {
681type Params = WorkDoneProgressCreateParams;
682type Result = ();
683const METHOD: &'static str = "window/workDoneProgress/create";
684}
685686/// The selection range request is sent from the client to the server to return
687/// suggested selection ranges at given positions. A selection range is a range
688/// around the cursor position which the user might be interested in selecting.
689///
690/// A selection range in the return array is for the position in the provided parameters at the same index.
691/// Therefore `positions[i]` must be contained in `result[i].range`.
692///
693/// Typically, but not necessary, selection ranges correspond to the nodes of the
694/// syntax tree.
695pub enum SelectionRangeRequest {}
696697impl Request for SelectionRangeRequest {
698type Params = SelectionRangeParams;
699type Result = Option<Vec<SelectionRange>>;
700const METHOD: &'static str = "textDocument/selectionRange";
701}
702703pub enum CallHierarchyPrepare {}
704705impl Request for CallHierarchyPrepare {
706type Params = CallHierarchyPrepareParams;
707type Result = Option<Vec<CallHierarchyItem>>;
708const METHOD: &'static str = "textDocument/prepareCallHierarchy";
709}
710711pub enum CallHierarchyIncomingCalls {}
712713impl Request for CallHierarchyIncomingCalls {
714type Params = CallHierarchyIncomingCallsParams;
715type Result = Option<Vec<CallHierarchyIncomingCall>>;
716const METHOD: &'static str = "callHierarchy/incomingCalls";
717}
718719pub enum CallHierarchyOutgoingCalls {}
720721impl Request for CallHierarchyOutgoingCalls {
722type Params = CallHierarchyOutgoingCallsParams;
723type Result = Option<Vec<CallHierarchyOutgoingCall>>;
724const METHOD: &'static str = "callHierarchy/outgoingCalls";
725}
726727pub enum SemanticTokensFullRequest {}
728729impl Request for SemanticTokensFullRequest {
730type Params = SemanticTokensParams;
731type Result = Option<SemanticTokensResult>;
732const METHOD: &'static str = "textDocument/semanticTokens/full";
733}
734735pub enum SemanticTokensFullDeltaRequest {}
736737impl Request for SemanticTokensFullDeltaRequest {
738type Params = SemanticTokensDeltaParams;
739type Result = Option<SemanticTokensFullDeltaResult>;
740const METHOD: &'static str = "textDocument/semanticTokens/full/delta";
741}
742743pub enum SemanticTokensRangeRequest {}
744745impl Request for SemanticTokensRangeRequest {
746type Params = SemanticTokensRangeParams;
747type Result = Option<SemanticTokensRangeResult>;
748const METHOD: &'static str = "textDocument/semanticTokens/range";
749}
750751/// The `workspace/semanticTokens/refresh` request is sent from the server to the client.
752/// Servers can use it to ask clients to refresh the editors for which this server provides semantic tokens.
753/// As a result the client should ask the server to recompute the semantic tokens for these editors.
754/// This is useful if a server detects a project wide configuration change which requires a re-calculation of all semantic tokens.
755/// Note that the client still has the freedom to delay the re-calculation of the semantic tokens if for example an editor is currently not visible.
756pub enum SemanticTokensRefresh {}
757758impl Request for SemanticTokensRefresh {
759type Params = ();
760type Result = ();
761const METHOD: &'static str = "workspace/semanticTokens/refresh";
762}
763764/// The workspace/codeLens/refresh request is sent from the server to the client.
765/// Servers can use it to ask clients to refresh the code lenses currently shown in editors.
766/// As a result the client should ask the server to recompute the code lenses for these editors.
767/// This is useful if a server detects a configuration change which requires a re-calculation of all code lenses.
768/// Note that the client still has the freedom to delay the re-calculation of the code lenses if for example an editor is currently not visible.
769pub enum CodeLensRefresh {}
770771impl Request for CodeLensRefresh {
772type Params = ();
773type Result = ();
774const METHOD: &'static str = "workspace/codeLens/refresh";
775}
776777/// The will create files request is sent from the client to the server before files are actually created as long as the creation is triggered from within the client. The request can return a WorkspaceEdit which will be applied to workspace before the files are created. Please note that clients might drop results if computing the edit took too long or if a server constantly fails on this request. This is done to keep creates fast and reliable.
778pub enum WillCreateFiles {}
779780impl Request for WillCreateFiles {
781type Params = CreateFilesParams;
782type Result = Option<WorkspaceEdit>;
783const METHOD: &'static str = "workspace/willCreateFiles";
784}
785786/// The will rename files request is sent from the client to the server before files are actually renamed as long as the rename is triggered from within the client. The request can return a WorkspaceEdit which will be applied to workspace before the files are renamed. Please note that clients might drop results if computing the edit took too long or if a server constantly fails on this request. This is done to keep renames fast and reliable.
787pub enum WillRenameFiles {}
788789impl Request for WillRenameFiles {
790type Params = RenameFilesParams;
791type Result = Option<WorkspaceEdit>;
792const METHOD: &'static str = "workspace/willRenameFiles";
793}
794795/// The will delete files request is sent from the client to the server before files are actually deleted as long as the deletion is triggered from within the client. The request can return a WorkspaceEdit which will be applied to workspace before the files are deleted. Please note that clients might drop results if computing the edit took too long or if a server constantly fails on this request. This is done to keep deletes fast and reliable.
796pub enum WillDeleteFiles {}
797798impl Request for WillDeleteFiles {
799type Params = DeleteFilesParams;
800type Result = Option<WorkspaceEdit>;
801const METHOD: &'static str = "workspace/willDeleteFiles";
802}
803804/// The show document request is sent from a server to a client to ask the client to display a particular document in the user interface.
805pub enum ShowDocument {}
806807impl Request for ShowDocument {
808type Params = ShowDocumentParams;
809type Result = ShowDocumentResult;
810const METHOD: &'static str = "window/showDocument";
811}
812813pub enum MonikerRequest {}
814815impl Request for MonikerRequest {
816type Params = MonikerParams;
817type Result = Option<Vec<Moniker>>;
818const METHOD: &'static str = "textDocument/moniker";
819}
820821/// The inlay hints request is sent from the client to the server to compute inlay hints for a given
822/// [text document, range] tuple that may be rendered in the editor in place with other text.
823pub enum InlayHintRequest {}
824825impl Request for InlayHintRequest {
826type Params = InlayHintParams;
827type Result = Option<Vec<InlayHint>>;
828const METHOD: &'static str = "textDocument/inlayHint";
829}
830831/// The `inlayHint/resolve` request is sent from the client to the server to resolve additional
832/// information for a given inlay hint. This is usually used to compute the tooltip, location or
833/// command properties of a inlay hint’s label part to avoid its unnecessary computation during the
834/// `textDocument/inlayHint` request.
835pub enum InlayHintResolveRequest {}
836837impl Request for InlayHintResolveRequest {
838type Params = InlayHint;
839type Result = InlayHint;
840const METHOD: &'static str = "inlayHint/resolve";
841}
842843/// The `workspace/inlayHint/refresh` request is sent from the server to the client. Servers can use
844/// it to ask clients to refresh the inlay hints currently shown in editors. As a result the client
845/// should ask the server to recompute the inlay hints for these editors. This is useful if a server
846/// detects a configuration change which requires a re-calculation of all inlay hints. Note that the
847/// client still has the freedom to delay the re-calculation of the inlay hints if for example an
848/// editor is currently not visible.
849pub enum InlayHintRefreshRequest {}
850851impl Request for InlayHintRefreshRequest {
852type Params = ();
853type Result = ();
854const METHOD: &'static str = "workspace/inlayHint/refresh";
855}
856857/// The inline value request is sent from the client to the server to compute inline values for a
858/// given text document that may be rendered in the editor at the end of lines.
859pub enum InlineValueRequest {}
860861impl Request for InlineValueRequest {
862type Params = InlineValueParams;
863type Result = Option<InlineValue>;
864const METHOD: &'static str = "textDocument/inlineValue";
865}
866867/// The `workspace/inlineValue/refresh` request is sent from the server to the client. Servers can
868/// use it to ask clients to refresh the inline values currently shown in editors. As a result the
869/// client should ask the server to recompute the inline values for these editors. This is useful if
870/// a server detects a configuration change which requires a re-calculation of all inline values.
871/// Note that the client still has the freedom to delay the re-calculation of the inline values if
872/// for example an editor is currently not visible.
873pub enum InlineValueRefreshRequest {}
874875impl Request for InlineValueRefreshRequest {
876type Params = ();
877type Result = ();
878const METHOD: &'static str = "workspace/inlineValue/refresh";
879}
880881/// The text document diagnostic request is sent from the client to the server to ask the server to
882/// compute the diagnostics for a given document. As with other pull requests the server is asked
883/// to compute the diagnostics for the currently synced version of the document.
884#[derive(Debug)]
885pub enum DocumentDiagnosticRequest {}
886887impl Request for DocumentDiagnosticRequest {
888type Params = DocumentDiagnosticParams;
889type Result = DocumentDiagnosticReportResult;
890const METHOD: &'static str = "textDocument/diagnostic";
891}
892893/// The workspace diagnostic request is sent from the client to the server to ask the server to
894/// compute workspace wide diagnostics which previously where pushed from the server to the client.
895/// In contrast to the document diagnostic request the workspace request can be long running and is
896/// not bound to a specific workspace or document state. If the client supports streaming for the
897/// workspace diagnostic pull it is legal to provide a document diagnostic report multiple times
898/// for the same document URI. The last one reported will win over previous reports.
899#[derive(Debug)]
900pub enum WorkspaceDiagnosticRequest {}
901902impl Request for WorkspaceDiagnosticRequest {
903type Params = WorkspaceDiagnosticParams;
904const METHOD: &'static str = "workspace/diagnostic";
905type Result = WorkspaceDiagnosticReportResult;
906}
907908/// The `workspace/diagnostic/refresh` request is sent from the server to the client. Servers can
909/// use it to ask clients to refresh all needed document and workspace diagnostics. This is useful
910/// if a server detects a project wide configuration change which requires a re-calculation of all
911/// diagnostics.
912#[derive(Debug)]
913pub enum WorkspaceDiagnosticRefresh {}
914915impl Request for WorkspaceDiagnosticRefresh {
916type Params = ();
917type Result = ();
918const METHOD: &'static str = "workspace/diagnostic/refresh";
919}
920921/// The type hierarchy request is sent from the client to the server to return a type hierarchy for
922/// the language element of given text document positions. Will return null if the server couldn’t
923/// infer a valid type from the position. The type hierarchy requests are executed in two steps:
924///
925/// 1. first a type hierarchy item is prepared for the given text document position.
926/// 2. for a type hierarchy item the supertype or subtype type hierarchy items are resolved.
927pub enum TypeHierarchyPrepare {}
928929impl Request for TypeHierarchyPrepare {
930type Params = TypeHierarchyPrepareParams;
931type Result = Option<Vec<TypeHierarchyItem>>;
932const METHOD: &'static str = "textDocument/prepareTypeHierarchy";
933}
934935/// The `typeHierarchy/supertypes` request is sent from the client to the server to resolve the
936/// supertypes for a given type hierarchy item. Will return null if the server couldn’t infer a
937/// valid type from item in the params. The request doesn’t define its own client and server
938/// capabilities. It is only issued if a server registers for the
939/// `textDocument/prepareTypeHierarchy` request.
940pub enum TypeHierarchySupertypes {}
941942impl Request for TypeHierarchySupertypes {
943type Params = TypeHierarchySupertypesParams;
944type Result = Option<Vec<TypeHierarchyItem>>;
945const METHOD: &'static str = "typeHierarchy/supertypes";
946}
947948/// The `typeHierarchy/subtypes` request is sent from the client to the server to resolve the
949/// subtypes for a given type hierarchy item. Will return null if the server couldn’t infer a valid
950/// type from item in the params. The request doesn’t define its own client and server capabilities.
951/// It is only issued if a server registers for the textDocument/prepareTypeHierarchy request.
952pub enum TypeHierarchySubtypes {}
953954impl Request for TypeHierarchySubtypes {
955type Params = TypeHierarchySubtypesParams;
956type Result = Option<Vec<TypeHierarchyItem>>;
957const METHOD: &'static str = "typeHierarchy/subtypes";
958}
959960#[cfg(test)]
961mod test {
962use super::*;
963964fn fake_call<R>()
965where
966R: Request,
967 R::Params: serde::Serialize,
968 R::Result: serde::de::DeserializeOwned,
969 {
970 }
971972macro_rules! check_macro {
973 ($name:tt) => {
974// check whether the macro name matches the method
975assert_eq!(<lsp_request!($name) as Request>::METHOD, $name);
976// test whether type checking passes for each component
977fake_call::<lsp_request!($name)>();
978 };
979 }
980981#[test]
982fn check_macro_definitions() {
983check_macro!("initialize");
984check_macro!("shutdown");
985986check_macro!("window/showDocument");
987check_macro!("window/showMessageRequest");
988check_macro!("window/workDoneProgress/create");
989990check_macro!("client/registerCapability");
991check_macro!("client/unregisterCapability");
992993check_macro!("textDocument/willSaveWaitUntil");
994check_macro!("textDocument/completion");
995check_macro!("textDocument/hover");
996check_macro!("textDocument/signatureHelp");
997check_macro!("textDocument/declaration");
998check_macro!("textDocument/definition");
999check_macro!("textDocument/references");
1000check_macro!("textDocument/documentHighlight");
1001check_macro!("textDocument/documentSymbol");
1002check_macro!("textDocument/codeAction");
1003check_macro!("textDocument/codeLens");
1004check_macro!("textDocument/documentLink");
1005check_macro!("textDocument/rangeFormatting");
1006check_macro!("textDocument/onTypeFormatting");
1007check_macro!("textDocument/formatting");
1008check_macro!("textDocument/rename");
1009check_macro!("textDocument/documentColor");
1010check_macro!("textDocument/colorPresentation");
1011check_macro!("textDocument/foldingRange");
1012check_macro!("textDocument/prepareRename");
1013check_macro!("textDocument/implementation");
1014check_macro!("textDocument/selectionRange");
1015check_macro!("textDocument/typeDefinition");
1016check_macro!("textDocument/moniker");
1017check_macro!("textDocument/linkedEditingRange");
1018check_macro!("textDocument/prepareCallHierarchy");
1019check_macro!("textDocument/prepareTypeHierarchy");
1020check_macro!("textDocument/semanticTokens/full");
1021check_macro!("textDocument/semanticTokens/full/delta");
1022check_macro!("textDocument/semanticTokens/range");
1023check_macro!("textDocument/inlayHint");
1024check_macro!("textDocument/inlineValue");
1025check_macro!("textDocument/diagnostic");
10261027check_macro!("workspace/applyEdit");
1028check_macro!("workspace/symbol");
1029check_macro!("workspace/executeCommand");
1030check_macro!("workspace/configuration");
1031check_macro!("workspace/diagnostic");
1032check_macro!("workspace/diagnostic/refresh");
1033check_macro!("workspace/willCreateFiles");
1034check_macro!("workspace/willRenameFiles");
1035check_macro!("workspace/willDeleteFiles");
1036check_macro!("workspace/workspaceFolders");
1037check_macro!("workspace/semanticTokens/refresh");
1038check_macro!("workspace/codeLens/refresh");
1039check_macro!("workspace/inlayHint/refresh");
1040check_macro!("workspace/inlineValue/refresh");
10411042check_macro!("callHierarchy/incomingCalls");
1043check_macro!("callHierarchy/outgoingCalls");
1044check_macro!("codeAction/resolve");
1045check_macro!("codeLens/resolve");
1046check_macro!("completionItem/resolve");
1047check_macro!("documentLink/resolve");
1048check_macro!("inlayHint/resolve");
1049check_macro!("typeHierarchy/subtypes");
1050check_macro!("typeHierarchy/supertypes");
1051check_macro!("workspaceSymbol/resolve");
1052 }
10531054#[test]
1055 #[cfg(feature = "proposed")]
1056fn check_proposed_macro_definitions() {}
1057}