Skip to main content

lsp_max/
language_server.rs

1use crate::jsonrpc::{Error, Result};
2use async_trait::async_trait;
3use auto_impl::auto_impl;
4use lsp_max_macros::rpc;
5use lsp_types_max::request::{
6    GotoDeclarationParams, GotoDeclarationResponse, GotoImplementationParams,
7    GotoImplementationResponse, GotoTypeDefinitionParams, GotoTypeDefinitionResponse,
8};
9use lsp_types_max::*;
10use serde_json::Value;
11
12pub(crate) mod impls;
13
14/// Trait implemented by language server backends to handle LSP requests and notifications.
15#[rpc]
16#[async_trait]
17#[auto_impl(Arc, Box)]
18pub trait LanguageServer: Send + Sync + 'static {
19    /// Handler for the `initialize` endpoint.
20    #[rpc(name = "initialize")]
21    async fn initialize(&self, params: InitializeParams) -> Result<InitializeResult>;
22    /// Handler for the `initialized` endpoint.
23    #[rpc(name = "initialized")]
24    async fn initialized(&self, params: InitializedParams) {
25        impls::initialized(params).await;
26    }
27    /// Handler for the `shutdown` endpoint.
28    #[rpc(name = "shutdown")]
29    async fn shutdown(&self) -> Result<()>;
30    /// Handler for the `did_open` endpoint.
31    #[rpc(name = "textDocument/didOpen")]
32    async fn did_open(&self, params: DidOpenTextDocumentParams) {
33        impls::did_open(params).await;
34    }
35    /// Handler for the `did_change` endpoint.
36    #[rpc(name = "textDocument/didChange")]
37    async fn did_change(&self, params: DidChangeTextDocumentParams) {
38        impls::did_change(params).await;
39    }
40    /// Handler for the `will_save` endpoint.
41    #[rpc(name = "textDocument/willSave")]
42    async fn will_save(&self, params: WillSaveTextDocumentParams) {
43        impls::will_save(params).await;
44    }
45    /// Handler for the `will_save_wait_until` endpoint.
46    #[rpc(name = "textDocument/willSaveWaitUntil")]
47    async fn will_save_wait_until(
48        &self,
49        params: WillSaveTextDocumentParams,
50    ) -> Result<Option<Vec<TextEdit>>> {
51        impls::will_save_wait_until(params).await
52    }
53    /// Handler for the `did_save` endpoint.
54    #[rpc(name = "textDocument/didSave")]
55    async fn did_save(&self, params: DidSaveTextDocumentParams) {
56        impls::did_save(params).await;
57    }
58    /// Handler for the `did_close` endpoint.
59    #[rpc(name = "textDocument/didClose")]
60    async fn did_close(&self, params: DidCloseTextDocumentParams) {
61        impls::did_close(params).await;
62    }
63    /// Handler for the `goto_declaration` endpoint.
64    #[rpc(name = "textDocument/declaration")]
65    async fn goto_declaration(
66        &self,
67        params: GotoDeclarationParams,
68    ) -> Result<Option<GotoDeclarationResponse>> {
69        impls::goto_declaration(params).await
70    }
71    /// Handler for the `goto_definition` endpoint.
72    #[rpc(name = "textDocument/definition")]
73    async fn goto_definition(
74        &self,
75        params: GotoDefinitionParams,
76    ) -> Result<Option<GotoDefinitionResponse>> {
77        impls::goto_definition(params).await
78    }
79    /// Handler for the `goto_type_definition` endpoint.
80    #[rpc(name = "textDocument/typeDefinition")]
81    async fn goto_type_definition(
82        &self,
83        params: GotoTypeDefinitionParams,
84    ) -> Result<Option<GotoTypeDefinitionResponse>> {
85        impls::goto_type_definition(params).await
86    }
87    /// Handler for the `goto_implementation` endpoint.
88    #[rpc(name = "textDocument/implementation")]
89    async fn goto_implementation(
90        &self,
91        params: GotoImplementationParams,
92    ) -> Result<Option<GotoImplementationResponse>> {
93        impls::goto_implementation(params).await
94    }
95    /// Handler for the `references` endpoint.
96    #[rpc(name = "textDocument/references")]
97    async fn references(&self, params: ReferenceParams) -> Result<Option<Vec<Location>>> {
98        impls::references(params).await
99    }
100    /// Handler for the `prepare_call_hierarchy` endpoint.
101    #[rpc(name = "textDocument/prepareCallHierarchy")]
102    async fn prepare_call_hierarchy(
103        &self,
104        params: CallHierarchyPrepareParams,
105    ) -> Result<Option<Vec<CallHierarchyItem>>> {
106        impls::prepare_call_hierarchy(params).await
107    }
108    /// Handler for the `incoming_calls` endpoint.
109    #[rpc(name = "callHierarchy/incomingCalls")]
110    async fn incoming_calls(
111        &self,
112        params: CallHierarchyIncomingCallsParams,
113    ) -> Result<Option<Vec<CallHierarchyIncomingCall>>> {
114        impls::incoming_calls(params).await
115    }
116    /// Handler for the `outgoing_calls` endpoint.
117    #[rpc(name = "callHierarchy/outgoingCalls")]
118    async fn outgoing_calls(
119        &self,
120        params: CallHierarchyOutgoingCallsParams,
121    ) -> Result<Option<Vec<CallHierarchyOutgoingCall>>> {
122        impls::outgoing_calls(params).await
123    }
124    /// Handler for the `prepare_type_hierarchy` endpoint.
125    #[rpc(name = "textDocument/prepareTypeHierarchy")]
126    async fn prepare_type_hierarchy(
127        &self,
128        params: TypeHierarchyPrepareParams,
129    ) -> Result<Option<Vec<TypeHierarchyItem>>> {
130        impls::prepare_type_hierarchy(params).await
131    }
132    /// Handler for the `supertypes` endpoint.
133    #[rpc(name = "typeHierarchy/supertypes")]
134    async fn supertypes(
135        &self,
136        params: TypeHierarchySupertypesParams,
137    ) -> Result<Option<Vec<TypeHierarchyItem>>> {
138        impls::supertypes(params).await
139    }
140    /// Handler for the `subtypes` endpoint.
141    #[rpc(name = "typeHierarchy/subtypes")]
142    async fn subtypes(
143        &self,
144        params: TypeHierarchySubtypesParams,
145    ) -> Result<Option<Vec<TypeHierarchyItem>>> {
146        impls::subtypes(params).await
147    }
148    /// Handler for the `document_highlight` endpoint.
149    #[rpc(name = "textDocument/documentHighlight")]
150    async fn document_highlight(
151        &self,
152        params: DocumentHighlightParams,
153    ) -> Result<Option<Vec<DocumentHighlight>>> {
154        impls::document_highlight(params).await
155    }
156    /// Handler for the `document_link` endpoint.
157    #[rpc(name = "textDocument/documentLink")]
158    async fn document_link(&self, params: DocumentLinkParams) -> Result<Option<Vec<DocumentLink>>> {
159        impls::document_link(params).await
160    }
161    /// Handler for the `document_link_resolve` endpoint.
162    #[rpc(name = "documentLink/resolve")]
163    async fn document_link_resolve(&self, params: DocumentLink) -> Result<DocumentLink> {
164        impls::document_link_resolve(params).await
165    }
166    /// Handler for the `hover` endpoint.
167    #[rpc(name = "textDocument/hover")]
168    async fn hover(&self, params: HoverParams) -> Result<Option<Hover>> {
169        impls::hover(params).await
170    }
171    /// Handler for the `code_lens` endpoint.
172    #[rpc(name = "textDocument/codeLens")]
173    async fn code_lens(&self, params: CodeLensParams) -> Result<Option<Vec<CodeLens>>> {
174        impls::code_lens(params).await
175    }
176    /// Handler for the `code_lens_resolve` endpoint.
177    #[rpc(name = "codeLens/resolve")]
178    async fn code_lens_resolve(&self, params: CodeLens) -> Result<CodeLens> {
179        impls::code_lens_resolve(params).await
180    }
181    /// Handler for the `folding_range` endpoint.
182    #[rpc(name = "textDocument/foldingRange")]
183    async fn folding_range(&self, params: FoldingRangeParams) -> Result<Option<Vec<FoldingRange>>> {
184        impls::folding_range(params).await
185    }
186    /// Handler for the `selection_range` endpoint.
187    #[rpc(name = "textDocument/selectionRange")]
188    async fn selection_range(
189        &self,
190        params: SelectionRangeParams,
191    ) -> Result<Option<Vec<SelectionRange>>> {
192        impls::selection_range(params).await
193    }
194    /// Handler for the `document_symbol` endpoint.
195    #[rpc(name = "textDocument/documentSymbol")]
196    async fn document_symbol(
197        &self,
198        params: DocumentSymbolParams,
199    ) -> Result<Option<DocumentSymbolResponse>> {
200        impls::document_symbol(params).await
201    }
202    /// Handler for the `semantic_tokens_full` endpoint.
203    #[rpc(name = "textDocument/semanticTokens/full")]
204    async fn semantic_tokens_full(
205        &self,
206        params: SemanticTokensParams,
207    ) -> Result<Option<SemanticTokensResult>> {
208        impls::semantic_tokens_full(params).await
209    }
210    /// Handler for the `semantic_tokens_full_delta` endpoint.
211    #[rpc(name = "textDocument/semanticTokens/full/delta")]
212    async fn semantic_tokens_full_delta(
213        &self,
214        params: SemanticTokensDeltaParams,
215    ) -> Result<Option<SemanticTokensFullDeltaResult>> {
216        impls::semantic_tokens_full_delta(params).await
217    }
218    /// Handler for the `semantic_tokens_range` endpoint.
219    #[rpc(name = "textDocument/semanticTokens/range")]
220    async fn semantic_tokens_range(
221        &self,
222        params: SemanticTokensRangeParams,
223    ) -> Result<Option<SemanticTokensRangeResult>> {
224        impls::semantic_tokens_range(params).await
225    }
226    /// Handler for the `inline_value` endpoint.
227    #[rpc(name = "textDocument/inlineValue")]
228    async fn inline_value(&self, params: InlineValueParams) -> Result<Option<Vec<InlineValue>>> {
229        impls::hints_ext::inline_value(params).await
230    }
231    /// Handler for the `inlay_hint` endpoint.
232    #[rpc(name = "textDocument/inlayHint")]
233    async fn inlay_hint(&self, params: InlayHintParams) -> Result<Option<Vec<InlayHint>>> {
234        impls::hints_ext::inlay_hint(params).await
235    }
236    /// Handler for the `inlay_hint_resolve` endpoint.
237    #[rpc(name = "inlayHint/resolve")]
238    async fn inlay_hint_resolve(&self, params: InlayHint) -> Result<InlayHint> {
239        impls::hints_ext::inlay_hint_resolve(params).await
240    }
241    /// Handler for the `moniker` endpoint.
242    #[rpc(name = "textDocument/moniker")]
243    async fn moniker(&self, params: MonikerParams) -> Result<Option<Vec<Moniker>>> {
244        impls::moniker(params).await
245    }
246    /// Handler for the `completion` endpoint.
247    #[rpc(name = "textDocument/completion")]
248    async fn completion(&self, params: CompletionParams) -> Result<Option<CompletionResponse>> {
249        impls::completion(params).await
250    }
251    /// Handler for the `completion_resolve` endpoint.
252    #[rpc(name = "completionItem/resolve")]
253    async fn completion_resolve(&self, params: CompletionItem) -> Result<CompletionItem> {
254        impls::completion_resolve(params).await
255    }
256    /// Handler for the `diagnostic` endpoint.
257    #[rpc(name = "textDocument/diagnostic")]
258    async fn diagnostic(
259        &self,
260        params: DocumentDiagnosticParams,
261    ) -> Result<DocumentDiagnosticReportResult> {
262        impls::diag_ext::diagnostic(params).await
263    }
264    /// Handler for the `workspace_diagnostic` endpoint.
265    #[rpc(name = "workspace/diagnostic")]
266    async fn workspace_diagnostic(
267        &self,
268        params: WorkspaceDiagnosticParams,
269    ) -> Result<WorkspaceDiagnosticReportResult> {
270        impls::diag_ext::workspace_diagnostic(params).await
271    }
272    /// Handler for the `signature_help` endpoint.
273    #[rpc(name = "textDocument/signatureHelp")]
274    async fn signature_help(&self, params: SignatureHelpParams) -> Result<Option<SignatureHelp>> {
275        impls::signature_help(params).await
276    }
277    /// Handler for the `code_action` endpoint.
278    #[rpc(name = "textDocument/codeAction")]
279    async fn code_action(&self, params: CodeActionParams) -> Result<Option<CodeActionResponse>> {
280        impls::code_action(params).await
281    }
282    /// Handler for the `code_action_resolve` endpoint.
283    #[rpc(name = "codeAction/resolve")]
284    async fn code_action_resolve(&self, params: CodeAction) -> Result<CodeAction> {
285        impls::symbols_ext::code_action_resolve(params).await
286    }
287    /// Handler for the `document_color` endpoint.
288    #[rpc(name = "textDocument/documentColor")]
289    async fn document_color(&self, params: DocumentColorParams) -> Result<Vec<ColorInformation>> {
290        impls::document_color(params).await
291    }
292    /// Handler for the `color_presentation` endpoint.
293    #[rpc(name = "textDocument/colorPresentation")]
294    async fn color_presentation(
295        &self,
296        params: ColorPresentationParams,
297    ) -> Result<Vec<ColorPresentation>> {
298        impls::color_presentation(params).await
299    }
300    /// Handler for the `formatting` endpoint.
301    #[rpc(name = "textDocument/formatting")]
302    async fn formatting(&self, params: DocumentFormattingParams) -> Result<Option<Vec<TextEdit>>> {
303        impls::formatting(params).await
304    }
305    /// Handler for the `range_formatting` endpoint.
306    #[rpc(name = "textDocument/rangeFormatting")]
307    async fn range_formatting(
308        &self,
309        params: DocumentRangeFormattingParams,
310    ) -> Result<Option<Vec<TextEdit>>> {
311        impls::range_formatting(params).await
312    }
313    /// Handler for the `on_type_formatting` endpoint.
314    #[rpc(name = "textDocument/onTypeFormatting")]
315    async fn on_type_formatting(
316        &self,
317        params: DocumentOnTypeFormattingParams,
318    ) -> Result<Option<Vec<TextEdit>>> {
319        impls::on_type_formatting(params).await
320    }
321    /// Handler for the `rename` endpoint.
322    #[rpc(name = "textDocument/rename")]
323    async fn rename(&self, params: RenameParams) -> Result<Option<WorkspaceEdit>> {
324        impls::rename(params).await
325    }
326    /// Handler for the `prepare_rename` endpoint.
327    #[rpc(name = "textDocument/prepareRename")]
328    async fn prepare_rename(
329        &self,
330        params: TextDocumentPositionParams,
331    ) -> Result<Option<PrepareRenameResponse>> {
332        impls::prepare_rename(params).await
333    }
334    /// Handler for the `linked_editing_range` endpoint.
335    #[rpc(name = "textDocument/linkedEditingRange")]
336    async fn linked_editing_range(
337        &self,
338        params: LinkedEditingRangeParams,
339    ) -> Result<Option<LinkedEditingRanges>> {
340        impls::fmt_ext::linked_editing_range(params).await
341    }
342    /// Handler for the `symbol` endpoint.
343    #[rpc(name = "workspace/symbol")]
344    async fn symbol(
345        &self,
346        params: WorkspaceSymbolParams,
347    ) -> Result<Option<Vec<SymbolInformation>>> {
348        impls::symbol(params).await
349    }
350    /// Handler for the `symbol_resolve` endpoint.
351    #[rpc(name = "workspaceSymbol/resolve")]
352    async fn symbol_resolve(&self, params: WorkspaceSymbol) -> Result<WorkspaceSymbol> {
353        impls::symbols_ext::symbol_resolve(params).await
354    }
355    /// Handler for the `did_change_configuration` endpoint.
356    #[rpc(name = "workspace/didChangeConfiguration")]
357    async fn did_change_configuration(&self, params: DidChangeConfigurationParams) {
358        impls::did_change_configuration(params).await;
359    }
360    /// Handler for the `did_change_workspace_folders` endpoint.
361    #[rpc(name = "workspace/didChangeWorkspaceFolders")]
362    async fn did_change_workspace_folders(&self, params: DidChangeWorkspaceFoldersParams) {
363        impls::did_change_workspace_folders(params).await;
364    }
365    /// Handler for the `will_create_files` endpoint.
366    #[rpc(name = "workspace/willCreateFiles")]
367    async fn will_create_files(&self, params: CreateFilesParams) -> Result<Option<WorkspaceEdit>> {
368        impls::will_create_files(params).await
369    }
370    /// Handler for the `did_create_files` endpoint.
371    #[rpc(name = "workspace/didCreateFiles")]
372    async fn did_create_files(&self, params: CreateFilesParams) {
373        impls::did_create_files(params).await;
374    }
375    /// Handler for the `will_rename_files` endpoint.
376    #[rpc(name = "workspace/willRenameFiles")]
377    async fn will_rename_files(&self, params: RenameFilesParams) -> Result<Option<WorkspaceEdit>> {
378        impls::will_rename_files(params).await
379    }
380    /// Handler for the `did_rename_files` endpoint.
381    #[rpc(name = "workspace/didRenameFiles")]
382    async fn did_rename_files(&self, params: RenameFilesParams) {
383        impls::did_rename_files(params).await;
384    }
385    /// Handler for the `will_delete_files` endpoint.
386    #[rpc(name = "workspace/willDeleteFiles")]
387    async fn will_delete_files(&self, params: DeleteFilesParams) -> Result<Option<WorkspaceEdit>> {
388        impls::will_delete_files(params).await
389    }
390    /// Handler for the `did_delete_files` endpoint.
391    #[rpc(name = "workspace/didDeleteFiles")]
392    async fn did_delete_files(&self, params: DeleteFilesParams) {
393        impls::did_delete_files(params).await;
394    }
395    /// Handler for the `did_change_watched_files` endpoint.
396    #[rpc(name = "workspace/didChangeWatchedFiles")]
397    async fn did_change_watched_files(&self, params: DidChangeWatchedFilesParams) {
398        impls::did_change_watched_files(params).await;
399    }
400    /// Handler for the `execute_command` endpoint.
401    #[rpc(name = "workspace/executeCommand")]
402    async fn execute_command(&self, params: ExecuteCommandParams) -> Result<Option<Value>> {
403        impls::execute_command(params).await
404    }
405    /// Handler for the `max_snapshot` endpoint.
406    #[rpc(name = "max/snapshot")]
407    async fn max_snapshot(&self) -> Result<max_protocol::SnapshotId> {
408        impls::max_snapshot().await
409    }
410    /// Handler for the `max_conformance_vector` endpoint.
411    #[rpc(name = "max/conformanceVector")]
412    async fn max_conformance_vector(
413        &self,
414        params: Option<max_protocol::SnapshotId>,
415    ) -> Result<max_protocol::ConformanceVector> {
416        impls::max_conformance_vector(params).await
417    }
418    /// Handler for the `max_explain_diagnostic` endpoint.
419    #[rpc(name = "max/explainDiagnostic")]
420    async fn max_explain_diagnostic(&self, params: String) -> Result<max_protocol::MaxDiagnostic> {
421        impls::max_explain_diagnostic(params).await
422    }
423    /// Handler for the `max_repair_plan` endpoint.
424    #[rpc(name = "max/repairPlan")]
425    async fn max_repair_plan(&self, params: String) -> Result<Vec<max_protocol::MaxCodeAction>> {
426        impls::max_repair_plan(params).await
427    }
428    /// Handler for the `max_apply_repair_transaction` endpoint.
429    #[rpc(name = "max/applyRepairTransaction")]
430    async fn max_apply_repair_transaction(
431        &self,
432        params: max_protocol::MaxCodeAction,
433    ) -> Result<max_protocol::Receipt> {
434        impls::max_apply_repair_transaction(params).await
435    }
436    /// Handler for the `max_export_analysis_bundle` endpoint.
437    #[rpc(name = "max/exportAnalysisBundle")]
438    async fn max_export_analysis_bundle(
439        &self,
440        params: max_protocol::SnapshotId,
441    ) -> Result<max_protocol::AnalysisBundle> {
442        impls::max_export_analysis_bundle(params).await
443    }
444    /// Handler for the `max_run_gate` endpoint.
445    #[rpc(name = "max/runGate")]
446    async fn max_run_gate(&self, params: max_protocol::GateId) -> Result<bool> {
447        impls::max_run_gate(params).await
448    }
449    /// Handler for the `max_clear_diagnostic` endpoint.
450    #[rpc(name = "max/clearDiagnostic")]
451    async fn max_clear_diagnostic(&self, params: String) -> Result<()> {
452        impls::max_clear_diagnostic(params).await
453    }
454    /// Handler for the `max_receipt` endpoint.
455    #[rpc(name = "max/receipt")]
456    async fn max_receipt(&self, params: String) -> Result<max_protocol::Receipt> {
457        impls::max_receipt(params).await
458    }
459    /// Handler for the `max_release_actuation` endpoint.
460    #[rpc(name = "max/releaseActuation")]
461    async fn max_release_actuation(&self, params: Value) -> Result<Value> {
462        impls::max_release_actuation(params).await
463    }
464    /// Handler for the `max_admission` endpoint.
465    #[rpc(name = "max/admission")]
466    async fn max_admission(&self) -> Result<serde_json::Value> {
467        impls::max_admission().await
468    }
469    /// Handler for the `max_autonomic_loop` endpoint.
470    #[rpc(name = "max/autonomicLoop")]
471    async fn max_autonomic_loop(&self) -> Result<serde_json::Value> {
472        impls::max_autonomic_loop().await
473    }
474    /// Handler for the `max_chain` endpoint.
475    #[rpc(name = "max/chain")]
476    async fn max_chain(&self) -> Result<serde_json::Value> {
477        impls::max_chain().await
478    }
479    /// Handler for the `max_hook` endpoint.
480    #[rpc(name = "max/hook")]
481    async fn max_hook(&self) -> Result<serde_json::Value> {
482        impls::max_hook().await
483    }
484    /// Handler for the `max_hook_graph` endpoint.
485    #[rpc(name = "max/hookGraph")]
486    async fn max_hook_graph(&self) -> Result<serde_json::Value> {
487        impls::max_hook_graph().await
488    }
489    /// Handler for the `max_lawful_transition` endpoint.
490    #[rpc(name = "max/lawfulTransition")]
491    async fn max_lawful_transition(&self, params: String) -> Result<serde_json::Value> {
492        impls::max_lawful_transition(params).await
493    }
494    /// Handler for the `max_ledger_report` endpoint.
495    #[rpc(name = "max/ledgerReport")]
496    async fn max_ledger_report(&self) -> Result<String> {
497        impls::max_ledger_report().await
498    }
499    /// Handler for the `max_manifold_snapshot` endpoint.
500    #[rpc(name = "max/manifoldSnapshot")]
501    async fn max_manifold_snapshot(&self) -> Result<serde_json::Value> {
502        impls::max_manifold_snapshot().await
503    }
504    /// Handler for the `max_propagate` endpoint.
505    #[rpc(name = "max/propagate")]
506    async fn max_propagate(&self, params: max_protocol::Receipt) -> Result<serde_json::Value> {
507        impls::max_propagate(params).await
508    }
509    /// Handler for the `max_refusal` endpoint.
510    #[rpc(name = "max/refusal")]
511    async fn max_refusal(&self, params: String) -> Result<serde_json::Value> {
512        impls::max_refusal(params).await
513    }
514    /// Handler for the `max_replay` endpoint.
515    #[rpc(name = "max/replay")]
516    async fn max_replay(&self) -> Result<serde_json::Value> {
517        impls::max_replay().await
518    }
519    /// Handler for the `max_verify_ledger` endpoint.
520    #[rpc(name = "max/verifyLedger")]
521    async fn max_verify_ledger(&self) -> Result<serde_json::Value> {
522        impls::max_verify_ledger().await
523    }
524    /// Handler for the `max_conformance_delta` endpoint.
525    #[rpc(name = "max/conformanceDelta")]
526    async fn max_conformance_delta(&self, params: serde_json::Value) -> Result<serde_json::Value> {
527        impls::max_conformance_delta(params).await
528    }
529    /// Handler for the `inline_completion` endpoint.
530    #[rpc(name = "textDocument/inlineCompletion")]
531    async fn inline_completion(
532        &self,
533        params: InlineCompletionParams,
534    ) -> Result<Option<InlineCompletionResponse>> {
535        impls::text_document::inline_completion(params).await
536    }
537    /// Handler for the `text_document_content` endpoint.
538    #[rpc(name = "workspace/textDocumentContent")]
539    async fn text_document_content(
540        &self,
541        params: max_protocol::lsp_3_18::TextDocumentContentParams,
542    ) -> Result<max_protocol::lsp_3_18::TextDocumentContentResult> {
543        let _ = params;
544        Err(Error::method_not_found())
545    }
546    /// Handler for the `max_dump_state` endpoint.
547    #[rpc(name = "max/dumpState")]
548    async fn max_dump_state(&self) -> Result<serde_json::Value> {
549        impls::max_dump_state().await
550    }
551    /// Handler for the `max_restore_state` endpoint.
552    #[rpc(name = "max/restoreState")]
553    async fn max_restore_state(&self, params: serde_json::Value) -> Result<()> {
554        impls::max_restore_state(params).await
555    }
556    /// Handler for the `ranges_formatting` endpoint.
557    #[rpc(name = "textDocument/rangesFormatting")]
558    async fn ranges_formatting(
559        &self,
560        params: max_protocol::lsp_3_18::DocumentRangesFormattingParams,
561    ) -> Result<Option<Vec<max_protocol::lsp_3_18::TextEdit>>> {
562        let _ = params;
563        Ok(None)
564    }
565    /// Handler for the `did_open_notebook_document` endpoint.
566    #[rpc(name = "notebookDocument/didOpen")]
567    async fn did_open_notebook_document(&self, params: DidOpenNotebookDocumentParams) {
568        impls::notebook_ext::did_open_notebook(params).await
569    }
570    /// Handler for the `did_change_notebook_document` endpoint.
571    #[rpc(name = "notebookDocument/didChange")]
572    async fn did_change_notebook_document(&self, params: DidChangeNotebookDocumentParams) {
573        impls::notebook_ext::did_change_notebook(params).await
574    }
575    /// Handler for the `did_save_notebook_document` endpoint.
576    #[rpc(name = "notebookDocument/didSave")]
577    async fn did_save_notebook_document(&self, params: DidSaveNotebookDocumentParams) {
578        impls::notebook_ext::did_save_notebook(params).await
579    }
580    /// Handler for the `did_close_notebook_document` endpoint.
581    #[rpc(name = "notebookDocument/didClose")]
582    async fn did_close_notebook_document(&self, params: DidCloseNotebookDocumentParams) {
583        impls::notebook_ext::did_close_notebook(params).await
584    }
585    /// Handler for the `work_done_progress_cancel` endpoint.
586    #[rpc(name = "window/workDoneProgress/cancel")]
587    async fn work_done_progress_cancel(&self, params: WorkDoneProgressCancelParams) {
588        impls::work_done_progress_cancel(params).await;
589    }
590    /// Handler for the `set_trace` endpoint.
591    #[rpc(name = "$/setTrace")]
592    async fn set_trace(&self, params: SetTraceParams) {
593        impls::set_trace(params).await;
594    }
595    /// Handler for the `progress` endpoint.
596    #[rpc(name = "$/progress")]
597    async fn progress(&self, params: ProgressParams) {
598        impls::progress(params).await;
599    }
600    /// Handler for the `max_instance_list` endpoint.
601    #[rpc(name = "max/instanceList")]
602    async fn max_instance_list(&self) -> Result<Value> {
603        impls::max_instance_list().await
604    }
605    /// Handler for the `max_reset` endpoint.
606    #[rpc(name = "max/reset")]
607    async fn max_reset(&self) -> Result<()> {
608        impls::max_reset().await
609    }
610    /// Handler for the `max_lsif` endpoint.
611    #[rpc(name = "max/lsif")]
612    async fn max_lsif(&self) -> Result<String> {
613        impls::max_lsif().await
614    }
615
616    /// Return all active rule packs with metadata and dependency graph.
617    #[rpc(name = "max/rulePacks")]
618    async fn max_rule_packs(&self) -> Result<Vec<max_protocol::RulePackDescriptor>> {
619        impls::max_rule_packs().await
620    }
621
622    /// Return conformance status contributed by a single rule pack.
623    #[rpc(name = "max/rulePackStatus")]
624    async fn max_rule_pack_status(
625        &self,
626        params: String,
627    ) -> Result<max_protocol::RulePackStatusResult> {
628        impls::max_rule_pack_status(params).await
629    }
630
631    /// Compare two workspace snapshots by seq number; return added/removed findings.
632    #[rpc(name = "max/rulePackDiff")]
633    async fn max_rule_pack_diff(
634        &self,
635        params: serde_json::Value,
636    ) -> Result<Vec<max_protocol::RulePackDiffEntry>> {
637        impls::max_rule_pack_diff(params).await
638    }
639
640    /// Workspace-level ConformanceVector aggregated across all open documents.
641    /// Refused axes propagate from any file; axes with no coverage remain Unknown.
642    #[rpc(name = "max/workspaceConformance")]
643    async fn max_workspace_conformance(&self) -> Result<max_protocol::ConformanceVector> {
644        impls::max_workspace_conformance().await
645    }
646
647    /// Executes a semantic SPARQL query over the codebase graph.
648    #[rpc(name = "workspace/executeSparql")]
649    async fn execute_sparql(
650        &self,
651        params: lsp_types_max::request::ExecuteSparqlParams,
652    ) -> Result<lsp_types_max::request::ExecuteSparqlResult> {
653        impls::execute_sparql(params).await
654    }
655
656    /// Validates an agent intent constraint using cognitive logic.
657    #[rpc(name = "max/intent.validate")]
658    async fn max_intent_validate(
659        &self,
660        params: max_protocol::IntentValidateParams,
661    ) -> Result<max_protocol::IntentValidateResult> {
662        impls::max_intent_validate(params).await
663    }
664}