Skip to main content

gen_lsp_types/generated/
common.rs

1use serde::{de::DeserializeOwned, Deserialize, Serialize};
2use std::{borrow::Cow, fmt};
3
4/// Indicates in which direction a message is sent in the protocol.
5#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
6pub enum MessageDirection {
7    ClientToServer,
8    ServerToClient,
9    Both,
10}
11pub trait Notification {
12    type Params: DeserializeOwned + Serialize + Send + Sync + 'static;
13    const METHOD: LspNotificationMethod<'static>;
14    const MESSAGE_DIRECTION: MessageDirection;
15}
16pub trait Request {
17    type Params: DeserializeOwned + Serialize + Send + Sync + 'static;
18    type Result: DeserializeOwned + Serialize + Send + Sync + 'static;
19    const METHOD: LspRequestMethod<'static>;
20    const MESSAGE_DIRECTION: MessageDirection;
21}
22pub trait RequestWithPartialResults: Request {
23    type PartialResult: DeserializeOwned + Serialize + Send + Sync + 'static;
24}
25#[cfg(all(not(feature = "url"), not(feature = "fluent-uri")))]
26/// URIs are transferred as strings. The URI's format is defined in https://tools.ietf.org/html/rfc3986.
27#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
28pub struct Uri(pub String);
29#[cfg(all(not(feature = "url"), not(feature = "fluent-uri")))]
30impl From<String> for Uri {
31    fn from(s: String) -> Self {
32        Self(s)
33    }
34}
35#[cfg(all(not(feature = "url"), not(feature = "fluent-uri")))]
36impl From<&str> for Uri {
37    fn from(s: &str) -> Self {
38        Self(s.into())
39    }
40}
41#[cfg(all(not(feature = "url"), not(feature = "fluent-uri")))]
42impl From<Box<str>> for Uri {
43    fn from(s: Box<str>) -> Self {
44        Self(s.into())
45    }
46}
47#[cfg(all(not(feature = "url"), not(feature = "fluent-uri")))]
48impl From<Cow<'_, str>> for Uri {
49    fn from(s: Cow<'_, str>) -> Self {
50        Self(s.into())
51    }
52}
53#[cfg(all(not(feature = "url"), not(feature = "fluent-uri")))]
54impl AsRef<str> for Uri {
55    fn as_ref(&self) -> &str {
56        &self.0
57    }
58}
59#[cfg(all(not(feature = "url"), not(feature = "fluent-uri")))]
60impl fmt::Display for Uri {
61    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
62        write!(f, "{}", self.0)
63    }
64}
65#[cfg(feature = "url")]
66pub type Uri = url::Url;
67#[cfg(all(feature = "fluent-uri", not(feature = "url")))]
68pub type Uri = fluent_uri::Uri<String>;
69#[cfg(all(feature = "url", feature = "fluent-uri"))]
70compile_error!(
71    "Features 'url' and 'fluent-uri' are mutually exclusive and cannot be enabled together."
72);
73
74#[derive(PartialEq, Eq, Hash, Debug, Clone, Copy, Serialize, Deserialize)]
75#[serde(into = "String", from = "&'a str")]
76pub enum LspRequestMethod<'a> {
77    TextDocumentImplementation,
78    TextDocumentTypeDefinition,
79    WorkspaceWorkspaceFolders,
80    WorkspaceConfiguration,
81    TextDocumentDocumentColor,
82    TextDocumentColorPresentation,
83    TextDocumentFoldingRange,
84    WorkspaceFoldingRangeRefresh,
85    TextDocumentDeclaration,
86    TextDocumentSelectionRange,
87    WindowWorkDoneProgressCreate,
88    TextDocumentPrepareCallHierarchy,
89    CallHierarchyIncomingCalls,
90    CallHierarchyOutgoingCalls,
91    TextDocumentSemanticTokensFull,
92    TextDocumentSemanticTokensFullDelta,
93    TextDocumentSemanticTokensRange,
94    WorkspaceSemanticTokensRefresh,
95    WindowShowDocument,
96    TextDocumentLinkedEditingRange,
97    WorkspaceWillCreateFiles,
98    WorkspaceWillRenameFiles,
99    WorkspaceWillDeleteFiles,
100    TextDocumentMoniker,
101    TextDocumentPrepareTypeHierarchy,
102    TypeHierarchySupertypes,
103    TypeHierarchySubtypes,
104    TextDocumentInlineValue,
105    WorkspaceInlineValueRefresh,
106    TextDocumentInlayHint,
107    InlayHintResolve,
108    WorkspaceInlayHintRefresh,
109    TextDocumentDiagnostic,
110    WorkspaceDiagnostic,
111    WorkspaceDiagnosticRefresh,
112    TextDocumentInlineCompletion,
113    WorkspaceTextDocumentContent,
114    WorkspaceTextDocumentContentRefresh,
115    ClientRegisterCapability,
116    ClientUnregisterCapability,
117    Initialize,
118    Shutdown,
119    WindowShowMessageRequest,
120    TextDocumentWillSaveWaitUntil,
121    TextDocumentCompletion,
122    CompletionItemResolve,
123    TextDocumentHover,
124    TextDocumentSignatureHelp,
125    TextDocumentDefinition,
126    TextDocumentReferences,
127    TextDocumentDocumentHighlight,
128    TextDocumentDocumentSymbol,
129    TextDocumentCodeAction,
130    CodeActionResolve,
131    WorkspaceSymbol,
132    WorkspaceSymbolResolve,
133    TextDocumentCodeLens,
134    CodeLensResolve,
135    WorkspaceCodeLensRefresh,
136    TextDocumentDocumentLink,
137    DocumentLinkResolve,
138    TextDocumentFormatting,
139    TextDocumentRangeFormatting,
140    TextDocumentRangesFormatting,
141    TextDocumentOnTypeFormatting,
142    TextDocumentRename,
143    TextDocumentPrepareRename,
144    WorkspaceExecuteCommand,
145    WorkspaceApplyEdit,
146    Custom(&'a str),
147}
148impl<'a> LspRequestMethod<'a> {
149    #[must_use]
150    pub const fn as_str(&self) -> &'a str {
151        match self {
152            Self::TextDocumentImplementation => "textDocument/implementation",
153            Self::TextDocumentTypeDefinition => "textDocument/typeDefinition",
154            Self::WorkspaceWorkspaceFolders => "workspace/workspaceFolders",
155            Self::WorkspaceConfiguration => "workspace/configuration",
156            Self::TextDocumentDocumentColor => "textDocument/documentColor",
157            Self::TextDocumentColorPresentation => "textDocument/colorPresentation",
158            Self::TextDocumentFoldingRange => "textDocument/foldingRange",
159            Self::WorkspaceFoldingRangeRefresh => "workspace/foldingRange/refresh",
160            Self::TextDocumentDeclaration => "textDocument/declaration",
161            Self::TextDocumentSelectionRange => "textDocument/selectionRange",
162            Self::WindowWorkDoneProgressCreate => "window/workDoneProgress/create",
163            Self::TextDocumentPrepareCallHierarchy => "textDocument/prepareCallHierarchy",
164            Self::CallHierarchyIncomingCalls => "callHierarchy/incomingCalls",
165            Self::CallHierarchyOutgoingCalls => "callHierarchy/outgoingCalls",
166            Self::TextDocumentSemanticTokensFull => "textDocument/semanticTokens/full",
167            Self::TextDocumentSemanticTokensFullDelta => {
168                "textDocument/semanticTokens/full/delta"
169            }
170            Self::TextDocumentSemanticTokensRange => "textDocument/semanticTokens/range",
171            Self::WorkspaceSemanticTokensRefresh => "workspace/semanticTokens/refresh",
172            Self::WindowShowDocument => "window/showDocument",
173            Self::TextDocumentLinkedEditingRange => "textDocument/linkedEditingRange",
174            Self::WorkspaceWillCreateFiles => "workspace/willCreateFiles",
175            Self::WorkspaceWillRenameFiles => "workspace/willRenameFiles",
176            Self::WorkspaceWillDeleteFiles => "workspace/willDeleteFiles",
177            Self::TextDocumentMoniker => "textDocument/moniker",
178            Self::TextDocumentPrepareTypeHierarchy => "textDocument/prepareTypeHierarchy",
179            Self::TypeHierarchySupertypes => "typeHierarchy/supertypes",
180            Self::TypeHierarchySubtypes => "typeHierarchy/subtypes",
181            Self::TextDocumentInlineValue => "textDocument/inlineValue",
182            Self::WorkspaceInlineValueRefresh => "workspace/inlineValue/refresh",
183            Self::TextDocumentInlayHint => "textDocument/inlayHint",
184            Self::InlayHintResolve => "inlayHint/resolve",
185            Self::WorkspaceInlayHintRefresh => "workspace/inlayHint/refresh",
186            Self::TextDocumentDiagnostic => "textDocument/diagnostic",
187            Self::WorkspaceDiagnostic => "workspace/diagnostic",
188            Self::WorkspaceDiagnosticRefresh => "workspace/diagnostic/refresh",
189            Self::TextDocumentInlineCompletion => "textDocument/inlineCompletion",
190            Self::WorkspaceTextDocumentContent => "workspace/textDocumentContent",
191            Self::WorkspaceTextDocumentContentRefresh => {
192                "workspace/textDocumentContent/refresh"
193            }
194            Self::ClientRegisterCapability => "client/registerCapability",
195            Self::ClientUnregisterCapability => "client/unregisterCapability",
196            Self::Initialize => "initialize",
197            Self::Shutdown => "shutdown",
198            Self::WindowShowMessageRequest => "window/showMessageRequest",
199            Self::TextDocumentWillSaveWaitUntil => "textDocument/willSaveWaitUntil",
200            Self::TextDocumentCompletion => "textDocument/completion",
201            Self::CompletionItemResolve => "completionItem/resolve",
202            Self::TextDocumentHover => "textDocument/hover",
203            Self::TextDocumentSignatureHelp => "textDocument/signatureHelp",
204            Self::TextDocumentDefinition => "textDocument/definition",
205            Self::TextDocumentReferences => "textDocument/references",
206            Self::TextDocumentDocumentHighlight => "textDocument/documentHighlight",
207            Self::TextDocumentDocumentSymbol => "textDocument/documentSymbol",
208            Self::TextDocumentCodeAction => "textDocument/codeAction",
209            Self::CodeActionResolve => "codeAction/resolve",
210            Self::WorkspaceSymbol => "workspace/symbol",
211            Self::WorkspaceSymbolResolve => "workspaceSymbol/resolve",
212            Self::TextDocumentCodeLens => "textDocument/codeLens",
213            Self::CodeLensResolve => "codeLens/resolve",
214            Self::WorkspaceCodeLensRefresh => "workspace/codeLens/refresh",
215            Self::TextDocumentDocumentLink => "textDocument/documentLink",
216            Self::DocumentLinkResolve => "documentLink/resolve",
217            Self::TextDocumentFormatting => "textDocument/formatting",
218            Self::TextDocumentRangeFormatting => "textDocument/rangeFormatting",
219            Self::TextDocumentRangesFormatting => "textDocument/rangesFormatting",
220            Self::TextDocumentOnTypeFormatting => "textDocument/onTypeFormatting",
221            Self::TextDocumentRename => "textDocument/rename",
222            Self::TextDocumentPrepareRename => "textDocument/prepareRename",
223            Self::WorkspaceExecuteCommand => "workspace/executeCommand",
224            Self::WorkspaceApplyEdit => "workspace/applyEdit",
225            Self::Custom(custom) => custom,
226        }
227    }
228    /// Creates a new [LspRequestMethod]. The created variant will **always** be [LspRequestMethod::Custom].
229    #[must_use]
230    pub const fn new(value: &'a str) -> Self {
231        Self::Custom(value)
232    }
233}
234impl<'a> From<&'a str> for LspRequestMethod<'a> {
235    /// Creates a new [LspRequestMethod] from a `&str`. The created variant will be
236    /// [LspRequestMethod::Custom] **if and only if** the `&str` does not match an
237    /// existing [LspRequestMethod].
238    fn from(value: &'a str) -> Self {
239        match value {
240            "textDocument/implementation" => Self::TextDocumentImplementation,
241            "textDocument/typeDefinition" => Self::TextDocumentTypeDefinition,
242            "workspace/workspaceFolders" => Self::WorkspaceWorkspaceFolders,
243            "workspace/configuration" => Self::WorkspaceConfiguration,
244            "textDocument/documentColor" => Self::TextDocumentDocumentColor,
245            "textDocument/colorPresentation" => Self::TextDocumentColorPresentation,
246            "textDocument/foldingRange" => Self::TextDocumentFoldingRange,
247            "workspace/foldingRange/refresh" => Self::WorkspaceFoldingRangeRefresh,
248            "textDocument/declaration" => Self::TextDocumentDeclaration,
249            "textDocument/selectionRange" => Self::TextDocumentSelectionRange,
250            "window/workDoneProgress/create" => Self::WindowWorkDoneProgressCreate,
251            "textDocument/prepareCallHierarchy" => Self::TextDocumentPrepareCallHierarchy,
252            "callHierarchy/incomingCalls" => Self::CallHierarchyIncomingCalls,
253            "callHierarchy/outgoingCalls" => Self::CallHierarchyOutgoingCalls,
254            "textDocument/semanticTokens/full" => Self::TextDocumentSemanticTokensFull,
255            "textDocument/semanticTokens/full/delta" => {
256                Self::TextDocumentSemanticTokensFullDelta
257            }
258            "textDocument/semanticTokens/range" => Self::TextDocumentSemanticTokensRange,
259            "workspace/semanticTokens/refresh" => Self::WorkspaceSemanticTokensRefresh,
260            "window/showDocument" => Self::WindowShowDocument,
261            "textDocument/linkedEditingRange" => Self::TextDocumentLinkedEditingRange,
262            "workspace/willCreateFiles" => Self::WorkspaceWillCreateFiles,
263            "workspace/willRenameFiles" => Self::WorkspaceWillRenameFiles,
264            "workspace/willDeleteFiles" => Self::WorkspaceWillDeleteFiles,
265            "textDocument/moniker" => Self::TextDocumentMoniker,
266            "textDocument/prepareTypeHierarchy" => Self::TextDocumentPrepareTypeHierarchy,
267            "typeHierarchy/supertypes" => Self::TypeHierarchySupertypes,
268            "typeHierarchy/subtypes" => Self::TypeHierarchySubtypes,
269            "textDocument/inlineValue" => Self::TextDocumentInlineValue,
270            "workspace/inlineValue/refresh" => Self::WorkspaceInlineValueRefresh,
271            "textDocument/inlayHint" => Self::TextDocumentInlayHint,
272            "inlayHint/resolve" => Self::InlayHintResolve,
273            "workspace/inlayHint/refresh" => Self::WorkspaceInlayHintRefresh,
274            "textDocument/diagnostic" => Self::TextDocumentDiagnostic,
275            "workspace/diagnostic" => Self::WorkspaceDiagnostic,
276            "workspace/diagnostic/refresh" => Self::WorkspaceDiagnosticRefresh,
277            "textDocument/inlineCompletion" => Self::TextDocumentInlineCompletion,
278            "workspace/textDocumentContent" => Self::WorkspaceTextDocumentContent,
279            "workspace/textDocumentContent/refresh" => {
280                Self::WorkspaceTextDocumentContentRefresh
281            }
282            "client/registerCapability" => Self::ClientRegisterCapability,
283            "client/unregisterCapability" => Self::ClientUnregisterCapability,
284            "initialize" => Self::Initialize,
285            "shutdown" => Self::Shutdown,
286            "window/showMessageRequest" => Self::WindowShowMessageRequest,
287            "textDocument/willSaveWaitUntil" => Self::TextDocumentWillSaveWaitUntil,
288            "textDocument/completion" => Self::TextDocumentCompletion,
289            "completionItem/resolve" => Self::CompletionItemResolve,
290            "textDocument/hover" => Self::TextDocumentHover,
291            "textDocument/signatureHelp" => Self::TextDocumentSignatureHelp,
292            "textDocument/definition" => Self::TextDocumentDefinition,
293            "textDocument/references" => Self::TextDocumentReferences,
294            "textDocument/documentHighlight" => Self::TextDocumentDocumentHighlight,
295            "textDocument/documentSymbol" => Self::TextDocumentDocumentSymbol,
296            "textDocument/codeAction" => Self::TextDocumentCodeAction,
297            "codeAction/resolve" => Self::CodeActionResolve,
298            "workspace/symbol" => Self::WorkspaceSymbol,
299            "workspaceSymbol/resolve" => Self::WorkspaceSymbolResolve,
300            "textDocument/codeLens" => Self::TextDocumentCodeLens,
301            "codeLens/resolve" => Self::CodeLensResolve,
302            "workspace/codeLens/refresh" => Self::WorkspaceCodeLensRefresh,
303            "textDocument/documentLink" => Self::TextDocumentDocumentLink,
304            "documentLink/resolve" => Self::DocumentLinkResolve,
305            "textDocument/formatting" => Self::TextDocumentFormatting,
306            "textDocument/rangeFormatting" => Self::TextDocumentRangeFormatting,
307            "textDocument/rangesFormatting" => Self::TextDocumentRangesFormatting,
308            "textDocument/onTypeFormatting" => Self::TextDocumentOnTypeFormatting,
309            "textDocument/rename" => Self::TextDocumentRename,
310            "textDocument/prepareRename" => Self::TextDocumentPrepareRename,
311            "workspace/executeCommand" => Self::WorkspaceExecuteCommand,
312            "workspace/applyEdit" => Self::WorkspaceApplyEdit,
313            _ => Self::Custom(value),
314        }
315    }
316}
317impl<'a> From<LspRequestMethod<'a>> for String {
318    fn from(value: LspRequestMethod<'a>) -> Self {
319        value.as_str().to_owned()
320    }
321}
322impl fmt::Display for LspRequestMethod<'_> {
323    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
324        let s = self.as_str();
325        write!(f, "{s}")
326    }
327}
328#[derive(PartialEq, Eq, Hash, Debug, Clone, Copy, Serialize, Deserialize)]
329#[serde(into = "String", from = "&'a str")]
330pub enum LspNotificationMethod<'a> {
331    WorkspaceDidChangeWorkspaceFolders,
332    WindowWorkDoneProgressCancel,
333    WorkspaceDidCreateFiles,
334    WorkspaceDidRenameFiles,
335    WorkspaceDidDeleteFiles,
336    NotebookDocumentDidOpen,
337    NotebookDocumentDidChange,
338    NotebookDocumentDidSave,
339    NotebookDocumentDidClose,
340    Initialized,
341    Exit,
342    WorkspaceDidChangeConfiguration,
343    WindowShowMessage,
344    WindowLogMessage,
345    TelemetryEvent,
346    TextDocumentDidOpen,
347    TextDocumentDidChange,
348    TextDocumentDidClose,
349    TextDocumentDidSave,
350    TextDocumentWillSave,
351    WorkspaceDidChangeWatchedFiles,
352    TextDocumentPublishDiagnostics,
353    SetTrace,
354    LogTrace,
355    CancelRequest,
356    Progress,
357    Custom(&'a str),
358}
359impl<'a> LspNotificationMethod<'a> {
360    #[must_use]
361    pub const fn as_str(&self) -> &'a str {
362        match self {
363            Self::WorkspaceDidChangeWorkspaceFolders => {
364                "workspace/didChangeWorkspaceFolders"
365            }
366            Self::WindowWorkDoneProgressCancel => "window/workDoneProgress/cancel",
367            Self::WorkspaceDidCreateFiles => "workspace/didCreateFiles",
368            Self::WorkspaceDidRenameFiles => "workspace/didRenameFiles",
369            Self::WorkspaceDidDeleteFiles => "workspace/didDeleteFiles",
370            Self::NotebookDocumentDidOpen => "notebookDocument/didOpen",
371            Self::NotebookDocumentDidChange => "notebookDocument/didChange",
372            Self::NotebookDocumentDidSave => "notebookDocument/didSave",
373            Self::NotebookDocumentDidClose => "notebookDocument/didClose",
374            Self::Initialized => "initialized",
375            Self::Exit => "exit",
376            Self::WorkspaceDidChangeConfiguration => "workspace/didChangeConfiguration",
377            Self::WindowShowMessage => "window/showMessage",
378            Self::WindowLogMessage => "window/logMessage",
379            Self::TelemetryEvent => "telemetry/event",
380            Self::TextDocumentDidOpen => "textDocument/didOpen",
381            Self::TextDocumentDidChange => "textDocument/didChange",
382            Self::TextDocumentDidClose => "textDocument/didClose",
383            Self::TextDocumentDidSave => "textDocument/didSave",
384            Self::TextDocumentWillSave => "textDocument/willSave",
385            Self::WorkspaceDidChangeWatchedFiles => "workspace/didChangeWatchedFiles",
386            Self::TextDocumentPublishDiagnostics => "textDocument/publishDiagnostics",
387            Self::SetTrace => "$/setTrace",
388            Self::LogTrace => "$/logTrace",
389            Self::CancelRequest => "$/cancelRequest",
390            Self::Progress => "$/progress",
391            Self::Custom(custom) => custom,
392        }
393    }
394    /// Creates a new [LspNotificationMethod]. The created variant will **always** be [LspNotificationMethod::Custom].
395    #[must_use]
396    pub const fn new(value: &'a str) -> Self {
397        Self::Custom(value)
398    }
399}
400impl<'a> From<&'a str> for LspNotificationMethod<'a> {
401    /// Creates a new [LspNotificationMethod] from a `&str`. The created variant will be
402    /// [LspNotificationMethod::Custom] **if and only if** the `&str` does not match an
403    /// existing [LspNotificationMethod].
404    fn from(value: &'a str) -> Self {
405        match value {
406            "workspace/didChangeWorkspaceFolders" => {
407                Self::WorkspaceDidChangeWorkspaceFolders
408            }
409            "window/workDoneProgress/cancel" => Self::WindowWorkDoneProgressCancel,
410            "workspace/didCreateFiles" => Self::WorkspaceDidCreateFiles,
411            "workspace/didRenameFiles" => Self::WorkspaceDidRenameFiles,
412            "workspace/didDeleteFiles" => Self::WorkspaceDidDeleteFiles,
413            "notebookDocument/didOpen" => Self::NotebookDocumentDidOpen,
414            "notebookDocument/didChange" => Self::NotebookDocumentDidChange,
415            "notebookDocument/didSave" => Self::NotebookDocumentDidSave,
416            "notebookDocument/didClose" => Self::NotebookDocumentDidClose,
417            "initialized" => Self::Initialized,
418            "exit" => Self::Exit,
419            "workspace/didChangeConfiguration" => Self::WorkspaceDidChangeConfiguration,
420            "window/showMessage" => Self::WindowShowMessage,
421            "window/logMessage" => Self::WindowLogMessage,
422            "telemetry/event" => Self::TelemetryEvent,
423            "textDocument/didOpen" => Self::TextDocumentDidOpen,
424            "textDocument/didChange" => Self::TextDocumentDidChange,
425            "textDocument/didClose" => Self::TextDocumentDidClose,
426            "textDocument/didSave" => Self::TextDocumentDidSave,
427            "textDocument/willSave" => Self::TextDocumentWillSave,
428            "workspace/didChangeWatchedFiles" => Self::WorkspaceDidChangeWatchedFiles,
429            "textDocument/publishDiagnostics" => Self::TextDocumentPublishDiagnostics,
430            "$/setTrace" => Self::SetTrace,
431            "$/logTrace" => Self::LogTrace,
432            "$/cancelRequest" => Self::CancelRequest,
433            "$/progress" => Self::Progress,
434            _ => Self::Custom(value),
435        }
436    }
437}
438impl<'a> From<LspNotificationMethod<'a>> for String {
439    fn from(value: LspNotificationMethod<'a>) -> Self {
440        value.as_str().to_owned()
441    }
442}
443impl fmt::Display for LspNotificationMethod<'_> {
444    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
445        let s = self.as_str();
446        write!(f, "{s}")
447    }
448}
449
450/// Get the [`Request`] type for a request method.
451///
452/// Example:
453///
454/// ```
455/// use gen_lsp_types::{Request, lsp_request};
456/// let params: <lsp_request!("textDocument/formatting") as Request>::Params;
457/// ```
458#[macro_export]
459macro_rules! lsp_request {
460    ("textDocument/implementation") => {
461        $crate::ImplementationRequest
462    };
463    ("textDocument/typeDefinition") => {
464        $crate::TypeDefinitionRequest
465    };
466    ("workspace/workspaceFolders") => {
467        $crate::WorkspaceFoldersRequest
468    };
469    ("workspace/configuration") => {
470        $crate::ConfigurationRequest
471    };
472    ("textDocument/documentColor") => {
473        $crate::DocumentColorRequest
474    };
475    ("textDocument/colorPresentation") => {
476        $crate::ColorPresentationRequest
477    };
478    ("textDocument/foldingRange") => {
479        $crate::FoldingRangeRequest
480    };
481    ("workspace/foldingRange/refresh") => {
482        $crate::FoldingRangeRefreshRequest
483    };
484    ("textDocument/declaration") => {
485        $crate::DeclarationRequest
486    };
487    ("textDocument/selectionRange") => {
488        $crate::SelectionRangeRequest
489    };
490    ("window/workDoneProgress/create") => {
491        $crate::WorkDoneProgressCreateRequest
492    };
493    ("textDocument/prepareCallHierarchy") => {
494        $crate::CallHierarchyPrepareRequest
495    };
496    ("callHierarchy/incomingCalls") => {
497        $crate::CallHierarchyIncomingCallsRequest
498    };
499    ("callHierarchy/outgoingCalls") => {
500        $crate::CallHierarchyOutgoingCallsRequest
501    };
502    ("textDocument/semanticTokens/full") => {
503        $crate::SemanticTokensRequest
504    };
505    ("textDocument/semanticTokens/full/delta") => {
506        $crate::SemanticTokensDeltaRequest
507    };
508    ("textDocument/semanticTokens/range") => {
509        $crate::SemanticTokensRangeRequest
510    };
511    ("workspace/semanticTokens/refresh") => {
512        $crate::SemanticTokensRefreshRequest
513    };
514    ("window/showDocument") => {
515        $crate::ShowDocumentRequest
516    };
517    ("textDocument/linkedEditingRange") => {
518        $crate::LinkedEditingRangeRequest
519    };
520    ("workspace/willCreateFiles") => {
521        $crate::WillCreateFilesRequest
522    };
523    ("workspace/willRenameFiles") => {
524        $crate::WillRenameFilesRequest
525    };
526    ("workspace/willDeleteFiles") => {
527        $crate::WillDeleteFilesRequest
528    };
529    ("textDocument/moniker") => {
530        $crate::MonikerRequest
531    };
532    ("textDocument/prepareTypeHierarchy") => {
533        $crate::TypeHierarchyPrepareRequest
534    };
535    ("typeHierarchy/supertypes") => {
536        $crate::TypeHierarchySupertypesRequest
537    };
538    ("typeHierarchy/subtypes") => {
539        $crate::TypeHierarchySubtypesRequest
540    };
541    ("textDocument/inlineValue") => {
542        $crate::InlineValueRequest
543    };
544    ("workspace/inlineValue/refresh") => {
545        $crate::InlineValueRefreshRequest
546    };
547    ("textDocument/inlayHint") => {
548        $crate::InlayHintRequest
549    };
550    ("inlayHint/resolve") => {
551        $crate::InlayHintResolveRequest
552    };
553    ("workspace/inlayHint/refresh") => {
554        $crate::InlayHintRefreshRequest
555    };
556    ("textDocument/diagnostic") => {
557        $crate::DocumentDiagnosticRequest
558    };
559    ("workspace/diagnostic") => {
560        $crate::WorkspaceDiagnosticRequest
561    };
562    ("workspace/diagnostic/refresh") => {
563        $crate::DiagnosticRefreshRequest
564    };
565    ("textDocument/inlineCompletion") => {
566        $crate::InlineCompletionRequest
567    };
568    ("workspace/textDocumentContent") => {
569        $crate::TextDocumentContentRequest
570    };
571    ("workspace/textDocumentContent/refresh") => {
572        $crate::TextDocumentContentRefreshRequest
573    };
574    ("client/registerCapability") => {
575        $crate::RegistrationRequest
576    };
577    ("client/unregisterCapability") => {
578        $crate::UnregistrationRequest
579    };
580    ("initialize") => {
581        $crate::InitializeRequest
582    };
583    ("shutdown") => {
584        $crate::ShutdownRequest
585    };
586    ("window/showMessageRequest") => {
587        $crate::ShowMessageRequest
588    };
589    ("textDocument/willSaveWaitUntil") => {
590        $crate::WillSaveTextDocumentWaitUntilRequest
591    };
592    ("textDocument/completion") => {
593        $crate::CompletionRequest
594    };
595    ("completionItem/resolve") => {
596        $crate::CompletionResolveRequest
597    };
598    ("textDocument/hover") => {
599        $crate::HoverRequest
600    };
601    ("textDocument/signatureHelp") => {
602        $crate::SignatureHelpRequest
603    };
604    ("textDocument/definition") => {
605        $crate::DefinitionRequest
606    };
607    ("textDocument/references") => {
608        $crate::ReferencesRequest
609    };
610    ("textDocument/documentHighlight") => {
611        $crate::DocumentHighlightRequest
612    };
613    ("textDocument/documentSymbol") => {
614        $crate::DocumentSymbolRequest
615    };
616    ("textDocument/codeAction") => {
617        $crate::CodeActionRequest
618    };
619    ("codeAction/resolve") => {
620        $crate::CodeActionResolveRequest
621    };
622    ("workspace/symbol") => {
623        $crate::WorkspaceSymbolRequest
624    };
625    ("workspaceSymbol/resolve") => {
626        $crate::WorkspaceSymbolResolveRequest
627    };
628    ("textDocument/codeLens") => {
629        $crate::CodeLensRequest
630    };
631    ("codeLens/resolve") => {
632        $crate::CodeLensResolveRequest
633    };
634    ("workspace/codeLens/refresh") => {
635        $crate::CodeLensRefreshRequest
636    };
637    ("textDocument/documentLink") => {
638        $crate::DocumentLinkRequest
639    };
640    ("documentLink/resolve") => {
641        $crate::DocumentLinkResolveRequest
642    };
643    ("textDocument/formatting") => {
644        $crate::DocumentFormattingRequest
645    };
646    ("textDocument/rangeFormatting") => {
647        $crate::DocumentRangeFormattingRequest
648    };
649    ("textDocument/rangesFormatting") => {
650        $crate::DocumentRangesFormattingRequest
651    };
652    ("textDocument/onTypeFormatting") => {
653        $crate::DocumentOnTypeFormattingRequest
654    };
655    ("textDocument/rename") => {
656        $crate::RenameRequest
657    };
658    ("textDocument/prepareRename") => {
659        $crate::PrepareRenameRequest
660    };
661    ("workspace/executeCommand") => {
662        $crate::ExecuteCommandRequest
663    };
664    ("workspace/applyEdit") => {
665        $crate::ApplyWorkspaceEditRequest
666    };
667}
668
669/// Get the [`Notification`] type for a notification method.
670///
671/// Example:
672///
673/// ```
674/// use gen_lsp_types::{Notification, lsp_notification};
675/// let params: <lsp_notification!("textDocument/didChange") as Notification>::Params;
676/// ```
677#[macro_export]
678macro_rules! lsp_notification {
679    ("workspace/didChangeWorkspaceFolders") => {
680        $crate::DidChangeWorkspaceFoldersNotification
681    };
682    ("window/workDoneProgress/cancel") => {
683        $crate::WorkDoneProgressCancelNotification
684    };
685    ("workspace/didCreateFiles") => {
686        $crate::DidCreateFilesNotification
687    };
688    ("workspace/didRenameFiles") => {
689        $crate::DidRenameFilesNotification
690    };
691    ("workspace/didDeleteFiles") => {
692        $crate::DidDeleteFilesNotification
693    };
694    ("notebookDocument/didOpen") => {
695        $crate::DidOpenNotebookDocumentNotification
696    };
697    ("notebookDocument/didChange") => {
698        $crate::DidChangeNotebookDocumentNotification
699    };
700    ("notebookDocument/didSave") => {
701        $crate::DidSaveNotebookDocumentNotification
702    };
703    ("notebookDocument/didClose") => {
704        $crate::DidCloseNotebookDocumentNotification
705    };
706    ("initialized") => {
707        $crate::InitializedNotification
708    };
709    ("exit") => {
710        $crate::ExitNotification
711    };
712    ("workspace/didChangeConfiguration") => {
713        $crate::DidChangeConfigurationNotification
714    };
715    ("window/showMessage") => {
716        $crate::ShowMessageNotification
717    };
718    ("window/logMessage") => {
719        $crate::LogMessageNotification
720    };
721    ("telemetry/event") => {
722        $crate::TelemetryEventNotification
723    };
724    ("textDocument/didOpen") => {
725        $crate::DidOpenTextDocumentNotification
726    };
727    ("textDocument/didChange") => {
728        $crate::DidChangeTextDocumentNotification
729    };
730    ("textDocument/didClose") => {
731        $crate::DidCloseTextDocumentNotification
732    };
733    ("textDocument/didSave") => {
734        $crate::DidSaveTextDocumentNotification
735    };
736    ("textDocument/willSave") => {
737        $crate::WillSaveTextDocumentNotification
738    };
739    ("workspace/didChangeWatchedFiles") => {
740        $crate::DidChangeWatchedFilesNotification
741    };
742    ("textDocument/publishDiagnostics") => {
743        $crate::PublishDiagnosticsNotification
744    };
745    ("$/setTrace") => {
746        $crate::SetTraceNotification
747    };
748    ("$/logTrace") => {
749        $crate::LogTraceNotification
750    };
751    ("$/cancelRequest") => {
752        $crate::CancelNotification
753    };
754    ("$/progress") => {
755        $crate::ProgressNotification
756    };
757}