From 9dce9a9c3e90a1f379a4f33b1e8fca290ab9e4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Jos=C3=A9=20Solano?= Date: Sat, 30 Nov 2024 14:40:34 -0800 Subject: [PATCH] Add capability information to the metamodel --- protocol/metaModel.json | 126 ++++++++++++++++++ protocol/metaModel.schema.json | 16 +++ protocol/src/common/protocol.callHierarchy.ts | 1 + protocol/src/common/protocol.colorProvider.ts | 1 + protocol/src/common/protocol.configuration.ts | 1 + protocol/src/common/protocol.declaration.ts | 1 + protocol/src/common/protocol.diagnostic.ts | 4 +- .../src/common/protocol.fileOperations.ts | 6 + protocol/src/common/protocol.foldingRange.ts | 2 + .../src/common/protocol.implementation.ts | 1 + protocol/src/common/protocol.inlayHint.ts | 3 + .../src/common/protocol.inlineCompletion.ts | 1 + protocol/src/common/protocol.inlineValue.ts | 2 + .../src/common/protocol.linkedEditingRange.ts | 1 + protocol/src/common/protocol.moniker.ts | 1 + protocol/src/common/protocol.progress.ts | 1 + .../src/common/protocol.selectionRange.ts | 1 + .../src/common/protocol.semanticTokens.ts | 4 + protocol/src/common/protocol.showDocument.ts | 1 + .../common/protocol.textDocumentContent.ts | 3 +- protocol/src/common/protocol.ts | 35 +++++ .../src/common/protocol.typeDefinition.ts | 1 + protocol/src/common/protocol.typeHierarchy.ts | 1 + .../src/common/protocol.workspaceFolder.ts | 2 + tools/src/metaModel.ts | 20 +++ tools/src/visitor.ts | 42 +++++- 26 files changed, 275 insertions(+), 3 deletions(-) diff --git a/protocol/metaModel.json b/protocol/metaModel.json index 20e17321a..40a250b45 100644 --- a/protocol/metaModel.json +++ b/protocol/metaModel.json @@ -27,6 +27,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.implementation", + "serverCapability": "implementationProvider", "params": { "kind": "reference", "name": "ImplementationParams" @@ -80,6 +82,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.typeDefinition", + "serverCapability": "typeDefinitionProvider", "params": { "kind": "reference", "name": "TypeDefinitionParams" @@ -129,6 +133,8 @@ ] }, "messageDirection": "serverToClient", + "clientCapability": "workspace.workspaceFolders", + "serverCapability": "workspace.workspaceFolders", "documentation": "The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders." }, { @@ -142,6 +148,7 @@ } }, "messageDirection": "serverToClient", + "clientCapability": "workspace.configuration", "params": { "kind": "reference", "name": "ConfigurationParams" @@ -159,6 +166,8 @@ } }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.colorProvider", + "serverCapability": "colorProvider", "params": { "kind": "reference", "name": "DocumentColorParams" @@ -233,6 +242,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.foldingRange", + "serverCapability": "foldingRangeProvider", "params": { "kind": "reference", "name": "FoldingRangeParams" @@ -258,6 +269,7 @@ "name": "null" }, "messageDirection": "serverToClient", + "clientCapability": "workspace.foldingRange.refreshSupport", "documentation": "@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true @@ -286,6 +298,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.declaration", + "serverCapability": "declarationProvider", "params": { "kind": "reference", "name": "DeclarationParams" @@ -335,6 +349,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.selectionRange", + "serverCapability": "selectionRangeProvider", "params": { "kind": "reference", "name": "SelectionRangeParams" @@ -360,6 +376,7 @@ "name": "null" }, "messageDirection": "serverToClient", + "clientCapability": "window.workDoneProgress", "params": { "kind": "reference", "name": "WorkDoneProgressCreateParams" @@ -386,6 +403,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.callHierarchy", + "serverCapability": "callHierarchyProvider", "params": { "kind": "reference", "name": "CallHierarchyPrepareParams" @@ -482,6 +501,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.semanticTokens", + "serverCapability": "semanticTokensProvider", "params": { "kind": "reference", "name": "SemanticTokensParams" @@ -519,6 +540,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.semanticTokens.requests.full.delta", + "serverCapability": "semanticTokensProvider.full.delta", "params": { "kind": "reference", "name": "SemanticTokensDeltaParams" @@ -561,6 +584,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.semanticTokens.requests.range", + "serverCapability": "semanticTokensProvider.range", "params": { "kind": "reference", "name": "SemanticTokensRangeParams" @@ -581,6 +606,7 @@ "name": "null" }, "messageDirection": "serverToClient", + "clientCapability": "workspace.semanticTokens.refreshSupport", "documentation": "@since 3.16.0", "since": "3.16.0" }, @@ -592,6 +618,7 @@ "name": "ShowDocumentResult" }, "messageDirection": "serverToClient", + "clientCapability": "window.showDocument.support", "params": { "kind": "reference", "name": "ShowDocumentParams" @@ -616,6 +643,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.linkedEditingRange", + "serverCapability": "linkedEditingRangeProvider", "params": { "kind": "reference", "name": "LinkedEditingRangeParams" @@ -644,6 +673,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "workspace.fileOperations.willCreate", + "serverCapability": "workspace.fileOperations.willCreate", "params": { "kind": "reference", "name": "CreateFilesParams" @@ -672,6 +703,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "workspace.fileOperations.willRename", + "serverCapability": "workspace.fileOperations.willRename", "params": { "kind": "reference", "name": "RenameFilesParams" @@ -700,6 +733,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "workspace.fileOperations.willDelete", + "serverCapability": "workspace.fileOperations.willDelete", "params": { "kind": "reference", "name": "DeleteFilesParams" @@ -731,6 +766,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.moniker", + "serverCapability": "monikerProvider", "params": { "kind": "reference", "name": "MonikerParams" @@ -768,6 +805,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.typeHierarchy", + "serverCapability": "typeHierarchyProvider", "params": { "kind": "reference", "name": "TypeHierarchyPrepareParams" @@ -867,6 +906,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.inlineValue", + "serverCapability": "inlineValueProvider", "params": { "kind": "reference", "name": "InlineValueParams" @@ -893,6 +934,7 @@ "name": "null" }, "messageDirection": "serverToClient", + "clientCapability": "workspace.inlineValue.refreshSupport", "documentation": "@since 3.17.0", "since": "3.17.0" }, @@ -916,6 +958,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.inlayHint", + "serverCapability": "inlayHintProvider", "params": { "kind": "reference", "name": "InlayHintParams" @@ -942,6 +986,8 @@ "name": "InlayHint" }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.inlayHint.resolveSupport", + "serverCapability": "inlayHintProvider.resolveProvider", "params": { "kind": "reference", "name": "InlayHint" @@ -957,6 +1003,7 @@ "name": "null" }, "messageDirection": "serverToClient", + "clientCapability": "workspace.inlayHint.refreshSupport", "documentation": "@since 3.17.0", "since": "3.17.0" }, @@ -968,6 +1015,8 @@ "name": "DocumentDiagnosticReport" }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.diagnostic", + "serverCapability": "diagnosticProvider", "params": { "kind": "reference", "name": "DocumentDiagnosticParams" @@ -995,6 +1044,8 @@ "name": "WorkspaceDiagnosticReport" }, "messageDirection": "clientToServer", + "clientCapability": "workspace.diagnostics", + "serverCapability": "diagnosticProvider.workspaceDiagnostics", "params": { "kind": "reference", "name": "WorkspaceDiagnosticParams" @@ -1018,6 +1069,7 @@ "name": "null" }, "messageDirection": "serverToClient", + "clientCapability": "workspace.diagnostics.refreshSupport", "documentation": "The diagnostic refresh request definition.\n\n@since 3.17.0", "since": "3.17.0" }, @@ -1045,6 +1097,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.inlineCompletion", + "serverCapability": "inlineCompletionProvider", "params": { "kind": "reference", "name": "InlineCompletionParams" @@ -1072,6 +1126,8 @@ "name": "TextDocumentContentResult" }, "messageDirection": "clientToServer", + "clientCapability": "workspace.textDocumentContent", + "serverCapability": "workspace.textDocumentContent", "params": { "kind": "reference", "name": "TextDocumentContentParams" @@ -1173,6 +1229,7 @@ ] }, "messageDirection": "serverToClient", + "clientCapability": "window.showMessage", "params": { "kind": "reference", "name": "ShowMessageRequestParams" @@ -1199,6 +1256,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.synchronization.willSaveWaitUntil", + "serverCapability": "textDocumentSync.willSaveWaitUntil", "params": { "kind": "reference", "name": "WillSaveTextDocumentParams" @@ -1233,6 +1292,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.completion", + "serverCapability": "completionProvider", "params": { "kind": "reference", "name": "CompletionParams" @@ -1258,6 +1319,8 @@ "name": "CompletionItem" }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.completion.completionItem.resolveSupport", + "serverCapability": "completionProvider.resolveProvider", "params": { "kind": "reference", "name": "CompletionItem" @@ -1281,6 +1344,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.hover", + "serverCapability": "hoverProvider", "params": { "kind": "reference", "name": "HoverParams" @@ -1308,6 +1373,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.signatureHelp", + "serverCapability": "signatureHelpProvider", "params": { "kind": "reference", "name": "SignatureHelpParams" @@ -1341,6 +1408,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.definition", + "serverCapability": "definitionProvider", "params": { "kind": "reference", "name": "DefinitionParams" @@ -1390,6 +1459,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.references", + "serverCapability": "referencesProvider", "params": { "kind": "reference", "name": "ReferenceParams" @@ -1427,6 +1498,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.documentHighlight", + "serverCapability": "documentHighlightProvider", "params": { "kind": "reference", "name": "DocumentHighlightParams" @@ -1471,6 +1544,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.documentSymbol", + "serverCapability": "documentSymbolProvider", "params": { "kind": "reference", "name": "DocumentSymbolParams" @@ -1529,6 +1604,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.codeAction", + "serverCapability": "codeActionProvider", "params": { "kind": "reference", "name": "CodeActionParams" @@ -1563,6 +1640,8 @@ "name": "CodeAction" }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.codeAction.resolveSupport", + "serverCapability": "codeActionProvider.resolveProvider", "params": { "kind": "reference", "name": "CodeAction" @@ -1596,6 +1675,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "workspace.symbol", + "serverCapability": "workspaceSymbolProvider", "params": { "kind": "reference", "name": "WorkspaceSymbolParams" @@ -1634,6 +1715,8 @@ "name": "WorkspaceSymbol" }, "messageDirection": "clientToServer", + "clientCapability": "workspace.symbol.resolveSupport", + "serverCapability": "workspaceSymbolProvider.resolveProvider", "params": { "kind": "reference", "name": "WorkspaceSymbol" @@ -1661,6 +1744,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.codeLens", + "serverCapability": "codeLensProvider", "params": { "kind": "reference", "name": "CodeLensParams" @@ -1686,6 +1771,8 @@ "name": "CodeLens" }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.codeLens.resolveSupport", + "serverCapability": "codeLensProvider.resolveProvider", "params": { "kind": "reference", "name": "CodeLens" @@ -1700,6 +1787,7 @@ "name": "null" }, "messageDirection": "serverToClient", + "clientCapability": "workspace.codeLens", "documentation": "A request to refresh all code actions\n\n@since 3.16.0", "since": "3.16.0" }, @@ -1723,6 +1811,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.documentLink", + "serverCapability": "documentLinkProvider", "params": { "kind": "reference", "name": "DocumentLinkParams" @@ -1748,6 +1838,8 @@ "name": "DocumentLink" }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.documentLink", + "serverCapability": "documentLinkProvider.resolveProvider", "params": { "kind": "reference", "name": "DocumentLink" @@ -1774,6 +1866,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.formatting", + "serverCapability": "documentFormattingProvider", "params": { "kind": "reference", "name": "DocumentFormattingParams" @@ -1834,6 +1928,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.rangeFormatting", + "serverCapability": "documentRangeFormattingProvider", "params": { "kind": "reference", "name": "DocumentRangesFormattingParams" @@ -1866,6 +1962,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.onTypeFormatting", + "serverCapability": "documentOnTypeFormattingProvider", "params": { "kind": "reference", "name": "DocumentOnTypeFormattingParams" @@ -1893,6 +1991,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.rename", + "serverCapability": "renameProvider", "params": { "kind": "reference", "name": "RenameParams" @@ -1920,6 +2020,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "textDocument.rename.prepareSupport", + "serverCapability": "renameProvider.prepareProvider", "params": { "kind": "reference", "name": "PrepareRenameParams" @@ -1944,6 +2046,8 @@ ] }, "messageDirection": "clientToServer", + "clientCapability": "workspace.executeCommand", + "serverCapability": "executeCommandProvider", "params": { "kind": "reference", "name": "ExecuteCommandParams" @@ -1962,6 +2066,7 @@ "name": "ApplyWorkspaceEditResult" }, "messageDirection": "serverToClient", + "clientCapability": "workspace.applyEdit", "params": { "kind": "reference", "name": "ApplyWorkspaceEditParams" @@ -1974,6 +2079,7 @@ "method": "workspace/didChangeWorkspaceFolders", "typeName": "DidChangeWorkspaceFoldersNotification", "messageDirection": "clientToServer", + "serverCapability": "workspace.workspaceFolders.changeNotifications", "params": { "kind": "reference", "name": "DidChangeWorkspaceFoldersParams" @@ -1994,6 +2100,8 @@ "method": "workspace/didCreateFiles", "typeName": "DidCreateFilesNotification", "messageDirection": "clientToServer", + "clientCapability": "workspace.fileOperations.didCreate", + "serverCapability": "workspace.fileOperations.didCreate", "params": { "kind": "reference", "name": "CreateFilesParams" @@ -2009,6 +2117,8 @@ "method": "workspace/didRenameFiles", "typeName": "DidRenameFilesNotification", "messageDirection": "clientToServer", + "clientCapability": "workspace.fileOperations.didRename", + "serverCapability": "workspace.fileOperations.didRename", "params": { "kind": "reference", "name": "RenameFilesParams" @@ -2024,6 +2134,8 @@ "method": "workspace/didDeleteFiles", "typeName": "DidDeleteFilesNotification", "messageDirection": "clientToServer", + "clientCapability": "workspace.fileOperations.didDelete", + "serverCapability": "workspace.fileOperations.didDelete", "params": { "kind": "reference", "name": "DeleteFilesParams" @@ -2117,6 +2229,7 @@ "method": "workspace/didChangeConfiguration", "typeName": "DidChangeConfigurationNotification", "messageDirection": "clientToServer", + "clientCapability": "workspace.didChangeConfiguration", "params": { "kind": "reference", "name": "DidChangeConfigurationParams" @@ -2131,6 +2244,7 @@ "method": "window/showMessage", "typeName": "ShowMessageNotification", "messageDirection": "serverToClient", + "clientCapability": "window.showMessage", "params": { "kind": "reference", "name": "ShowMessageParams" @@ -2161,6 +2275,8 @@ "method": "textDocument/didOpen", "typeName": "DidOpenTextDocumentNotification", "messageDirection": "clientToServer", + "clientCapability": "textDocument.synchronization", + "serverCapability": "textDocumentSync", "params": { "kind": "reference", "name": "DidOpenTextDocumentParams" @@ -2175,6 +2291,8 @@ "method": "textDocument/didChange", "typeName": "DidChangeTextDocumentNotification", "messageDirection": "clientToServer", + "clientCapability": "textDocument.synchronization", + "serverCapability": "textDocumentSync", "params": { "kind": "reference", "name": "DidChangeTextDocumentParams" @@ -2189,6 +2307,8 @@ "method": "textDocument/didClose", "typeName": "DidCloseTextDocumentNotification", "messageDirection": "clientToServer", + "clientCapability": "textDocument.synchronization", + "serverCapability": "textDocumentSync", "params": { "kind": "reference", "name": "DidCloseTextDocumentParams" @@ -2203,6 +2323,8 @@ "method": "textDocument/didSave", "typeName": "DidSaveTextDocumentNotification", "messageDirection": "clientToServer", + "clientCapability": "textDocument.synchronization.didSave", + "serverCapability": "textDocumentSync.save", "params": { "kind": "reference", "name": "DidSaveTextDocumentParams" @@ -2217,6 +2339,8 @@ "method": "textDocument/willSave", "typeName": "WillSaveTextDocumentNotification", "messageDirection": "clientToServer", + "clientCapability": "textDocument.synchronization.willSave", + "serverCapability": "textDocumentSync.willSave", "params": { "kind": "reference", "name": "WillSaveTextDocumentParams" @@ -2231,6 +2355,7 @@ "method": "workspace/didChangeWatchedFiles", "typeName": "DidChangeWatchedFilesNotification", "messageDirection": "clientToServer", + "clientCapability": "workspace.didChangeWatchedFiles", "params": { "kind": "reference", "name": "DidChangeWatchedFilesParams" @@ -2245,6 +2370,7 @@ "method": "textDocument/publishDiagnostics", "typeName": "PublishDiagnosticsNotification", "messageDirection": "serverToClient", + "clientCapability": "textDocument.publishDiagnostics", "params": { "kind": "reference", "name": "PublishDiagnosticsParams" diff --git a/protocol/metaModel.schema.json b/protocol/metaModel.schema.json index d4a80dacd..52f2db074 100644 --- a/protocol/metaModel.schema.json +++ b/protocol/metaModel.schema.json @@ -362,6 +362,10 @@ "additionalProperties": false, "description": "Represents a LSP notification", "properties": { + "clientCapability": { + "description": "The client capability property path if any.", + "type": "string" + }, "deprecated": { "description": "Whether the notification is deprecated or not. If deprecated the property contains the deprecation message.", "type": "string" @@ -404,6 +408,10 @@ "$ref": "#/definitions/Type", "description": "Optional registration options if the notification supports dynamic registration." }, + "serverCapability": { + "description": "The server capability property path if any.", + "type": "string" + }, "since": { "description": "Since when (release number) this notification is available. Is undefined if not known.", "type": "string" @@ -515,6 +523,10 @@ "additionalProperties": false, "description": "Represents a LSP request", "properties": { + "clientCapability": { + "description": "The client capability property path if any.", + "type": "string" + }, "deprecated": { "description": "Whether the request is deprecated or not. If deprecated the property contains the deprecation message.", "type": "string" @@ -569,6 +581,10 @@ "$ref": "#/definitions/Type", "description": "The result type." }, + "serverCapability": { + "description": "The server capability property path if any.", + "type": "string" + }, "since": { "description": "Since when (release number) this request is available. Is undefined if not known.", "type": "string" diff --git a/protocol/src/common/protocol.callHierarchy.ts b/protocol/src/common/protocol.callHierarchy.ts index 663068507..ab0e7a951 100644 --- a/protocol/src/common/protocol.callHierarchy.ts +++ b/protocol/src/common/protocol.callHierarchy.ts @@ -59,6 +59,7 @@ export namespace CallHierarchyPrepareRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.callHierarchy'; server: 'callHierarchyProvider' } = { client: 'textDocument.callHierarchy', server: 'callHierarchyProvider' }; } /** diff --git a/protocol/src/common/protocol.colorProvider.ts b/protocol/src/common/protocol.colorProvider.ts index 1e97ad77c..6547eb63c 100644 --- a/protocol/src/common/protocol.colorProvider.ts +++ b/protocol/src/common/protocol.colorProvider.ts @@ -51,6 +51,7 @@ export namespace DocumentColorRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.colorProvider'; server: 'colorProvider' } = { client: 'textDocument.colorProvider', server: 'colorProvider' }; } /** diff --git a/protocol/src/common/protocol.configuration.ts b/protocol/src/common/protocol.configuration.ts index 980cc746e..e7468d332 100644 --- a/protocol/src/common/protocol.configuration.ts +++ b/protocol/src/common/protocol.configuration.ts @@ -25,6 +25,7 @@ export namespace ConfigurationRequest { export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; export type MiddlewareSignature = (params: ConfigurationParams, token: CancellationToken, next: HandlerSignature) => HandlerResult; + export const capabilities: { client: 'workspace.configuration' } = { client: 'workspace.configuration' }; } diff --git a/protocol/src/common/protocol.declaration.ts b/protocol/src/common/protocol.declaration.ts index bf0c995f2..f68644a1e 100644 --- a/protocol/src/common/protocol.declaration.ts +++ b/protocol/src/common/protocol.declaration.ts @@ -52,4 +52,5 @@ export namespace DeclarationRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.declaration'; server: 'declarationProvider' } = { client: 'textDocument.declaration', server: 'declarationProvider' }; } diff --git a/protocol/src/common/protocol.diagnostic.ts b/protocol/src/common/protocol.diagnostic.ts index a24f0cfc3..30f4a4a83 100644 --- a/protocol/src/common/protocol.diagnostic.ts +++ b/protocol/src/common/protocol.diagnostic.ts @@ -13,7 +13,6 @@ import type { DiagnosticsCapabilities } from './protocol'; - /** * Client capabilities specific to diagnostic pull requests. * @@ -269,6 +268,7 @@ export namespace DocumentDiagnosticRequest { export const type = new ProtocolRequestType(method); export const partialResult = new ProgressType(); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.diagnostic'; server: 'diagnosticProvider' } = { client: 'textDocument.diagnostic', server: 'diagnosticProvider' }; } /** @@ -382,6 +382,7 @@ export namespace WorkspaceDiagnosticRequest { export const type = new ProtocolRequestType(method); export const partialResult = new ProgressType(); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'workspace.diagnostics'; server: 'diagnosticProvider.workspaceDiagnostics' } = { client: 'workspace.diagnostics', server: 'diagnosticProvider.workspaceDiagnostics' }; } /** @@ -394,4 +395,5 @@ export namespace DiagnosticRefreshRequest { export const messageDirection: MessageDirection = MessageDirection.serverToClient; export const type = new ProtocolRequestType0(method); export type HandlerSignature = RequestHandler0; + export const capabilities: { client: 'workspace.diagnostics.refreshSupport' } = { client: 'workspace.diagnostics.refreshSupport' }; } diff --git a/protocol/src/common/protocol.fileOperations.ts b/protocol/src/common/protocol.fileOperations.ts index c3ee98c2b..540ffd31a 100644 --- a/protocol/src/common/protocol.fileOperations.ts +++ b/protocol/src/common/protocol.fileOperations.ts @@ -292,6 +292,7 @@ export namespace WillCreateFilesRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'workspace.fileOperations.willCreate'; server: 'workspace.fileOperations.willCreate' } = { client: 'workspace.fileOperations.willCreate', server: 'workspace.fileOperations.willCreate' }; } /** @@ -305,6 +306,7 @@ export namespace DidCreateFilesNotification { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolNotificationType(method); export type HandlerSignature = NotificationHandler; + export const capabilities: { client: 'workspace.fileOperations.didCreate'; server: 'workspace.fileOperations.didCreate' } = { client: 'workspace.fileOperations.didCreate', server: 'workspace.fileOperations.didCreate' }; } /** @@ -318,6 +320,7 @@ export namespace WillRenameFilesRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'workspace.fileOperations.willRename'; server: 'workspace.fileOperations.willRename' } = { client: 'workspace.fileOperations.willRename', server: 'workspace.fileOperations.willRename' }; } /** @@ -331,6 +334,7 @@ export namespace DidRenameFilesNotification { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolNotificationType(method); export type HandlerSignature = NotificationHandler; + export const capabilities: { client: 'workspace.fileOperations.didRename'; server: 'workspace.fileOperations.didRename' } = { client: 'workspace.fileOperations.didRename', server: 'workspace.fileOperations.didRename' }; } /** @@ -344,6 +348,7 @@ export namespace DidDeleteFilesNotification { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolNotificationType(method); export type HandlerSignature = NotificationHandler; + export const capabilities: { client: 'workspace.fileOperations.didDelete'; server: 'workspace.fileOperations.didDelete' } = { client: 'workspace.fileOperations.didDelete', server: 'workspace.fileOperations.didDelete' }; } /** @@ -357,4 +362,5 @@ export namespace WillDeleteFilesRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'workspace.fileOperations.willDelete'; server: 'workspace.fileOperations.willDelete' } = { client: 'workspace.fileOperations.willDelete', server: 'workspace.fileOperations.willDelete' }; } diff --git a/protocol/src/common/protocol.foldingRange.ts b/protocol/src/common/protocol.foldingRange.ts index 09d222d26..a3e21e70f 100644 --- a/protocol/src/common/protocol.foldingRange.ts +++ b/protocol/src/common/protocol.foldingRange.ts @@ -128,6 +128,7 @@ export namespace FoldingRangeRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.foldingRange'; server: 'foldingRangeProvider' } = { client: 'textDocument.foldingRange', server: 'foldingRangeProvider' }; } /** @@ -139,4 +140,5 @@ export namespace FoldingRangeRefreshRequest { export const messageDirection: MessageDirection = MessageDirection.serverToClient; export const type = new ProtocolRequestType0(method); export type HandlerSignature = RequestHandler0; + export const capabilities: { client: 'workspace.foldingRange.refreshSupport' } = { client: 'workspace.foldingRange.refreshSupport' }; } diff --git a/protocol/src/common/protocol.implementation.ts b/protocol/src/common/protocol.implementation.ts index d5e7194f4..fbb391ba9 100644 --- a/protocol/src/common/protocol.implementation.ts +++ b/protocol/src/common/protocol.implementation.ts @@ -53,4 +53,5 @@ export namespace ImplementationRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.implementation'; server: 'implementationProvider' } = { client: 'textDocument.implementation', server: 'implementationProvider' }; } diff --git a/protocol/src/common/protocol.inlayHint.ts b/protocol/src/common/protocol.inlayHint.ts index 634a9ab9a..0d4bc678c 100644 --- a/protocol/src/common/protocol.inlayHint.ts +++ b/protocol/src/common/protocol.inlayHint.ts @@ -105,6 +105,7 @@ export namespace InlayHintRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.inlayHint'; server: 'inlayHintProvider' } = { client: 'textDocument.inlayHint', server: 'inlayHintProvider' }; } /** @@ -119,6 +120,7 @@ export namespace InlayHintResolveRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.inlayHint.resolveSupport'; server: 'inlayHintProvider.resolveProvider' } = { client: 'textDocument.inlayHint.resolveSupport', server: 'inlayHintProvider.resolveProvider' }; } /** @@ -129,4 +131,5 @@ export namespace InlayHintRefreshRequest { export const messageDirection: MessageDirection = MessageDirection.serverToClient; export const type = new ProtocolRequestType0(method); export type HandlerSignature = RequestHandler0; + export const capabilities: { client: 'workspace.inlayHint.refreshSupport' } = { client: 'workspace.inlayHint.refreshSupport' }; } diff --git a/protocol/src/common/protocol.inlineCompletion.ts b/protocol/src/common/protocol.inlineCompletion.ts index d69d959c6..0754f542d 100644 --- a/protocol/src/common/protocol.inlineCompletion.ts +++ b/protocol/src/common/protocol.inlineCompletion.ts @@ -67,4 +67,5 @@ export namespace InlineCompletionRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.inlineCompletion'; server: 'inlineCompletionProvider' } = { client: 'textDocument.inlineCompletion', server: 'inlineCompletionProvider' }; } diff --git a/protocol/src/common/protocol.inlineValue.ts b/protocol/src/common/protocol.inlineValue.ts index a74a68e84..0ddb14485 100644 --- a/protocol/src/common/protocol.inlineValue.ts +++ b/protocol/src/common/protocol.inlineValue.ts @@ -90,6 +90,7 @@ export namespace InlineValueRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.inlineValue'; server: 'inlineValueProvider' } = { client: 'textDocument.inlineValue', server: 'inlineValueProvider' }; } /** @@ -100,4 +101,5 @@ export namespace InlineValueRefreshRequest { export const messageDirection: MessageDirection = MessageDirection.serverToClient; export const type = new ProtocolRequestType0(method); export type HandlerSignature = RequestHandler0; + export const capabilities: { client: 'workspace.inlineValue.refreshSupport' } = { client: 'workspace.inlineValue.refreshSupport' }; } diff --git a/protocol/src/common/protocol.linkedEditingRange.ts b/protocol/src/common/protocol.linkedEditingRange.ts index 695fd11a3..6ec44ffd4 100644 --- a/protocol/src/common/protocol.linkedEditingRange.ts +++ b/protocol/src/common/protocol.linkedEditingRange.ts @@ -65,4 +65,5 @@ export namespace LinkedEditingRangeRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.linkedEditingRange'; server: 'linkedEditingRangeProvider' } = { client: 'textDocument.linkedEditingRange', server: 'linkedEditingRangeProvider' }; } diff --git a/protocol/src/common/protocol.moniker.ts b/protocol/src/common/protocol.moniker.ts index 8847fa24b..6c9be1196 100644 --- a/protocol/src/common/protocol.moniker.ts +++ b/protocol/src/common/protocol.moniker.ts @@ -130,4 +130,5 @@ export namespace MonikerRequest { export const method: 'textDocument/moniker' = 'textDocument/moniker'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.moniker'; server: 'monikerProvider' } = { client: 'textDocument.moniker', server: 'monikerProvider' }; } diff --git a/protocol/src/common/protocol.progress.ts b/protocol/src/common/protocol.progress.ts index 03dbe9863..9930697f3 100644 --- a/protocol/src/common/protocol.progress.ts +++ b/protocol/src/common/protocol.progress.ts @@ -114,6 +114,7 @@ export namespace WorkDoneProgressCreateRequest { export const messageDirection: MessageDirection = MessageDirection.serverToClient; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'window.workDoneProgress' } = { client: 'window.workDoneProgress' }; } export interface WorkDoneProgressCancelParams { diff --git a/protocol/src/common/protocol.selectionRange.ts b/protocol/src/common/protocol.selectionRange.ts index 5523a97d5..c6677c3a1 100644 --- a/protocol/src/common/protocol.selectionRange.ts +++ b/protocol/src/common/protocol.selectionRange.ts @@ -54,4 +54,5 @@ export namespace SelectionRangeRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.selectionRange'; server: 'selectionRangeProvider' } = { client: 'textDocument.selectionRange', server: 'selectionRangeProvider' }; } diff --git a/protocol/src/common/protocol.semanticTokens.ts b/protocol/src/common/protocol.semanticTokens.ts index de8d6de46..984e8b933 100644 --- a/protocol/src/common/protocol.semanticTokens.ts +++ b/protocol/src/common/protocol.semanticTokens.ts @@ -204,6 +204,7 @@ export namespace SemanticTokensRequest { export const type = new ProtocolRequestType(method); export const registrationMethod: typeof SemanticTokensRegistrationType.method = SemanticTokensRegistrationType.method; export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.semanticTokens'; server: 'semanticTokensProvider' } = { client: 'textDocument.semanticTokens', server: 'semanticTokensProvider' }; } //------- 'textDocument/semanticTokens/edits' ----- @@ -233,6 +234,7 @@ export namespace SemanticTokensDeltaRequest { export const type = new ProtocolRequestType(method); export const registrationMethod: typeof SemanticTokensRegistrationType.method = SemanticTokensRegistrationType.method; export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.semanticTokens.requests.full.delta'; server: 'semanticTokensProvider.full.delta' } = { client: 'textDocument.semanticTokens.requests.full.delta', server: 'semanticTokensProvider.full.delta' }; } //------- 'textDocument/semanticTokens/range' ----- @@ -261,6 +263,7 @@ export namespace SemanticTokensRangeRequest { export const type = new ProtocolRequestType(method); export const registrationMethod: typeof SemanticTokensRegistrationType.method = SemanticTokensRegistrationType.method; export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.semanticTokens.requests.range'; server: 'semanticTokensProvider.range' } = { client: 'textDocument.semanticTokens.requests.range', server: 'semanticTokensProvider.range' }; } //------- 'workspace/semanticTokens/refresh' ----- @@ -289,4 +292,5 @@ export namespace SemanticTokensRefreshRequest { export const messageDirection: MessageDirection = MessageDirection.serverToClient; export const type = new ProtocolRequestType0(method); export type HandlerSignature = RequestHandler0; + export const capabilities: { client: 'workspace.semanticTokens.refreshSupport' } = { client: 'workspace.semanticTokens.refreshSupport' }; } diff --git a/protocol/src/common/protocol.showDocument.ts b/protocol/src/common/protocol.showDocument.ts index 338521b8e..547854ae6 100644 --- a/protocol/src/common/protocol.showDocument.ts +++ b/protocol/src/common/protocol.showDocument.ts @@ -81,4 +81,5 @@ export namespace ShowDocumentRequest { export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; export type MiddlewareSignature = (params: ShowDocumentParams, token: CancellationToken, next: HandlerSignature) => HandlerResult; + export const capabilities: { client: 'window.showDocument.support' } = { client: 'window.showDocument.support' }; } diff --git a/protocol/src/common/protocol.textDocumentContent.ts b/protocol/src/common/protocol.textDocumentContent.ts index 545783ff2..366ac48d7 100644 --- a/protocol/src/common/protocol.textDocumentContent.ts +++ b/protocol/src/common/protocol.textDocumentContent.ts @@ -84,6 +84,7 @@ export namespace TextDocumentContentRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'workspace.textDocumentContent'; server: 'workspace.textDocumentContent' } = { client: 'workspace.textDocumentContent', server: 'workspace.textDocumentContent' }; } /** @@ -111,4 +112,4 @@ export namespace TextDocumentContentRefreshRequest { export const messageDirection: MessageDirection = MessageDirection.serverToClient; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; -} \ No newline at end of file +} diff --git a/protocol/src/common/protocol.ts b/protocol/src/common/protocol.ts index a8ad848da..1b6d70b72 100644 --- a/protocol/src/common/protocol.ts +++ b/protocol/src/common/protocol.ts @@ -1674,6 +1674,7 @@ export namespace DidChangeConfigurationNotification { export const method: 'workspace/didChangeConfiguration' = 'workspace/didChangeConfiguration'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolNotificationType(method); + export const capabilities: { client: 'workspace.didChangeConfiguration' } = { client: 'workspace.didChangeConfiguration' }; } export interface DidChangeConfigurationRegistrationOptions { @@ -1746,6 +1747,7 @@ export namespace ShowMessageNotification { export const method: 'window/showMessage' = 'window/showMessage'; export const messageDirection: MessageDirection = MessageDirection.serverToClient; export const type = new ProtocolNotificationType(method); + export const capabilities: { client: 'window.showMessage' } = { client: 'window.showMessage' }; } /** @@ -1809,6 +1811,7 @@ export namespace ShowMessageRequest { export const method: 'window/showMessageRequest' = 'window/showMessageRequest'; export const messageDirection: MessageDirection = MessageDirection.serverToClient; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'window.showMessage' } = { client: 'window.showMessage' }; } /** @@ -1962,6 +1965,7 @@ export namespace DidOpenTextDocumentNotification { export const method: 'textDocument/didOpen' = 'textDocument/didOpen'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolNotificationType(method); + export const capabilities: { client: 'textDocument.synchronization'; server: 'textDocumentSync' } = { client: 'textDocument.synchronization', server: 'textDocumentSync' }; } /** @@ -2069,6 +2073,7 @@ export namespace DidChangeTextDocumentNotification { export const method: 'textDocument/didChange' = 'textDocument/didChange'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolNotificationType(method); + export const capabilities: { client: 'textDocument.synchronization'; server: 'textDocumentSync' } = { client: 'textDocument.synchronization', server: 'textDocumentSync' }; } /** @@ -2094,6 +2099,7 @@ export namespace DidCloseTextDocumentNotification { export const method: 'textDocument/didClose' = 'textDocument/didClose'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolNotificationType(method); + export const capabilities: { client: 'textDocument.synchronization'; server: 'textDocumentSync' } = { client: 'textDocument.synchronization', server: 'textDocumentSync' }; } /** @@ -2126,6 +2132,7 @@ export namespace DidSaveTextDocumentNotification { export const method: 'textDocument/didSave' = 'textDocument/didSave'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolNotificationType(method); + export const capabilities: { client: 'textDocument.synchronization.didSave'; server: 'textDocumentSync.save' } = { client: 'textDocument.synchronization.didSave', server: 'textDocumentSync.save' }; } /** @@ -2175,6 +2182,7 @@ export namespace WillSaveTextDocumentNotification { export const method: 'textDocument/willSave' = 'textDocument/willSave'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolNotificationType(method); + export const capabilities: { client: 'textDocument.synchronization.willSave'; server: 'textDocumentSync.willSave' } = { client: 'textDocument.synchronization.willSave', server: 'textDocumentSync.willSave' }; } /** @@ -2189,6 +2197,7 @@ export namespace WillSaveTextDocumentWaitUntilRequest { export const method: 'textDocument/willSaveWaitUntil' = 'textDocument/willSaveWaitUntil'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.synchronization.willSaveWaitUntil'; server: 'textDocumentSync.willSaveWaitUntil' } = { client: 'textDocument.synchronization.willSaveWaitUntil', server: 'textDocumentSync.willSaveWaitUntil' }; } //---- File eventing ---- @@ -2218,6 +2227,7 @@ export namespace DidChangeWatchedFilesNotification { export const method: 'workspace/didChangeWatchedFiles' = 'workspace/didChangeWatchedFiles'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolNotificationType(method); + export const capabilities: { client: 'workspace.didChangeWatchedFiles' } = { client: 'workspace.didChangeWatchedFiles' }; } /** @@ -2452,6 +2462,7 @@ export namespace PublishDiagnosticsNotification { export const method: 'textDocument/publishDiagnostics' = 'textDocument/publishDiagnostics'; export const messageDirection: MessageDirection = MessageDirection.serverToClient; export const type = new ProtocolNotificationType(method); + export const capabilities: { client: 'textDocument.publishDiagnostics' } = { client: 'textDocument.publishDiagnostics' }; } //---- Completion Support -------------------------- @@ -2787,6 +2798,7 @@ export namespace CompletionRequest { export const method: 'textDocument/completion' = 'textDocument/completion'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.completion'; server: 'completionProvider' } = { client: 'textDocument.completion', server: 'completionProvider' }; } /** @@ -2798,6 +2810,7 @@ export namespace CompletionResolveRequest { export const method: 'completionItem/resolve' = 'completionItem/resolve'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.completion.completionItem.resolveSupport'; server: 'completionProvider.resolveProvider' } = { client: 'textDocument.completion.completionItem.resolveSupport', server: 'completionProvider.resolveProvider' }; } //---- Hover Support ------------------------------- @@ -2842,6 +2855,7 @@ export namespace HoverRequest { export const method: 'textDocument/hover' = 'textDocument/hover'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.hover'; server: 'hoverProvider' } = { client: 'textDocument.hover', server: 'hoverProvider' }; } //---- SignatureHelp ---------------------------------- @@ -3018,6 +3032,7 @@ export namespace SignatureHelpRequest { export const method: 'textDocument/signatureHelp' = 'textDocument/signatureHelp'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.signatureHelp'; server: 'signatureHelpProvider' } = { client: 'textDocument.signatureHelp', server: 'signatureHelpProvider' }; } //---- Goto Definition ------------------------------------- @@ -3067,6 +3082,7 @@ export namespace DefinitionRequest { export const method: 'textDocument/definition' = 'textDocument/definition'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.definition'; server: 'definitionProvider' } = { client: 'textDocument.definition', server: 'definitionProvider' }; } //---- Reference Provider ---------------------------------- @@ -3110,6 +3126,7 @@ export namespace ReferencesRequest { export const method: 'textDocument/references' = 'textDocument/references'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.references'; server: 'referencesProvider' } = { client: 'textDocument.references', server: 'referencesProvider' }; } //---- Document Highlight ---------------------------------- @@ -3152,6 +3169,7 @@ export namespace DocumentHighlightRequest { export const method: 'textDocument/documentHighlight' = 'textDocument/documentHighlight'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.documentHighlight'; server: 'documentHighlightProvider' } = { client: 'textDocument.documentHighlight', server: 'documentHighlightProvider' }; } //---- Document Symbol Provider --------------------------- @@ -3233,6 +3251,7 @@ export namespace DocumentSymbolRequest { export const method: 'textDocument/documentSymbol' = 'textDocument/documentSymbol'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.documentSymbol'; server: 'documentSymbolProvider' } = { client: 'textDocument.documentSymbol', server: 'documentSymbolProvider' }; } //---- Code Action Provider ---------------------------------- @@ -3457,6 +3476,7 @@ export namespace CodeActionRequest { export const method: 'textDocument/codeAction' = 'textDocument/codeAction'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.codeAction'; server: 'codeActionProvider' } = { client: 'textDocument.codeAction', server: 'codeActionProvider' }; } /** @@ -3468,6 +3488,7 @@ export namespace CodeActionResolveRequest { export const method: 'codeAction/resolve' = 'codeAction/resolve'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.codeAction.resolveSupport'; server: 'codeActionProvider.resolveProvider' } = { client: 'textDocument.codeAction.resolveSupport', server: 'codeActionProvider.resolveProvider' }; } //---- Workspace Symbol Provider --------------------------- @@ -3594,6 +3615,7 @@ export namespace WorkspaceSymbolRequest { export const method: 'workspace/symbol' = 'workspace/symbol'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'workspace.symbol'; server: 'workspaceSymbolProvider' } = { client: 'workspace.symbol', server: 'workspaceSymbolProvider' }; } /** @@ -3606,6 +3628,7 @@ export namespace WorkspaceSymbolResolveRequest { export const method: 'workspaceSymbol/resolve' = 'workspaceSymbol/resolve'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'workspace.symbol.resolveSupport'; server: 'workspaceSymbolProvider.resolveProvider' } = { client: 'workspace.symbol.resolveSupport', server: 'workspaceSymbolProvider.resolveProvider' }; } //---- Code Lens Provider ------------------------------------------- @@ -3687,6 +3710,7 @@ export namespace CodeLensRequest { export const method: 'textDocument/codeLens' = 'textDocument/codeLens'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.codeLens'; server: 'codeLensProvider' } = { client: 'textDocument.codeLens', server: 'codeLensProvider' }; } /** @@ -3696,6 +3720,7 @@ export namespace CodeLensResolveRequest { export const method: 'codeLens/resolve' = 'codeLens/resolve'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.codeLens.resolveSupport'; server: 'codeLensProvider.resolveProvider' } = { client: 'textDocument.codeLens.resolveSupport', server: 'codeLensProvider.resolveProvider' }; } /** @@ -3707,6 +3732,7 @@ export namespace CodeLensRefreshRequest { export const method: `workspace/codeLens/refresh` = `workspace/codeLens/refresh`; export const messageDirection: MessageDirection = MessageDirection.serverToClient; export const type = new ProtocolRequestType0(method); + export const capabilities: { client: 'workspace.codeLens' } = { client: 'workspace.codeLens' }; } //---- Document Links ---------------------------------------------- @@ -3760,6 +3786,7 @@ export namespace DocumentLinkRequest { export const method: 'textDocument/documentLink' = 'textDocument/documentLink'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.documentLink'; server: 'documentLinkProvider' } = { client: 'textDocument.documentLink', server: 'documentLinkProvider' }; } /** @@ -3771,6 +3798,7 @@ export namespace DocumentLinkResolveRequest { export const method: 'documentLink/resolve' = 'documentLink/resolve'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.documentLink'; server: 'documentLinkProvider.resolveProvider' } = { client: 'textDocument.documentLink', server: 'documentLinkProvider.resolveProvider' }; } //---- Formatting ---------------------------------------------- @@ -3819,6 +3847,7 @@ export namespace DocumentFormattingRequest { export const method: 'textDocument/formatting' = 'textDocument/formatting'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.formatting'; server: 'documentFormattingProvider' } = { client: 'textDocument.formatting', server: 'documentFormattingProvider' }; } /** @@ -3920,6 +3949,7 @@ export namespace DocumentRangesFormattingRequest { export const method: 'textDocument/rangesFormatting' = 'textDocument/rangesFormatting'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.rangeFormatting'; server: 'documentRangeFormattingProvider' } = { client: 'textDocument.rangeFormatting', server: 'documentRangeFormattingProvider' }; } /** @@ -3991,6 +4021,7 @@ export namespace DocumentOnTypeFormattingRequest { export const method: 'textDocument/onTypeFormatting' = 'textDocument/onTypeFormatting'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.onTypeFormatting'; server: 'documentOnTypeFormattingProvider' } = { client: 'textDocument.onTypeFormatting', server: 'documentOnTypeFormattingProvider' }; } //---- Rename ---------------------------------------------- @@ -4088,6 +4119,7 @@ export namespace RenameRequest { export const method: 'textDocument/rename' = 'textDocument/rename'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.rename'; server: 'renameProvider' } = { client: 'textDocument.rename', server: 'renameProvider' }; } export interface PrepareRenameParams extends TextDocumentPositionParams, WorkDoneProgressParams { @@ -4119,6 +4151,7 @@ export namespace PrepareRenameRequest { export const method: 'textDocument/prepareRename' = 'textDocument/prepareRename'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'textDocument.rename.prepareSupport'; server: 'renameProvider.prepareProvider' } = { client: 'textDocument.rename.prepareSupport', server: 'renameProvider.prepareProvider' }; } //---- Command Execution ------------------------------------------- @@ -4172,6 +4205,7 @@ export namespace ExecuteCommandRequest { export const method: 'workspace/executeCommand' = 'workspace/executeCommand'; export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); + export const capabilities: { client: 'workspace.executeCommand'; server: 'executeCommandProvider' } = { client: 'workspace.executeCommand', server: 'executeCommandProvider' }; } //---- Apply Edit request ---------------------------------------- @@ -4310,6 +4344,7 @@ export namespace ApplyWorkspaceEditRequest { export const messageDirection: MessageDirection = MessageDirection.serverToClient; export const type = new ProtocolRequestType('workspace/applyEdit'); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'workspace.applyEdit' } = { client: 'workspace.applyEdit' }; } export { diff --git a/protocol/src/common/protocol.typeDefinition.ts b/protocol/src/common/protocol.typeDefinition.ts index 528216bdc..d71ed8042 100644 --- a/protocol/src/common/protocol.typeDefinition.ts +++ b/protocol/src/common/protocol.typeDefinition.ts @@ -53,4 +53,5 @@ export namespace TypeDefinitionRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.typeDefinition'; server: 'typeDefinitionProvider' } = { client: 'textDocument.typeDefinition', server: 'typeDefinitionProvider' }; } diff --git a/protocol/src/common/protocol.typeHierarchy.ts b/protocol/src/common/protocol.typeHierarchy.ts index da2899641..0c7eb6581 100644 --- a/protocol/src/common/protocol.typeHierarchy.ts +++ b/protocol/src/common/protocol.typeHierarchy.ts @@ -56,6 +56,7 @@ export namespace TypeHierarchyPrepareRequest { export const messageDirection: MessageDirection = MessageDirection.clientToServer; export const type = new ProtocolRequestType(method); export type HandlerSignature = RequestHandler; + export const capabilities: { client: 'textDocument.typeHierarchy'; server: 'typeHierarchyProvider' } = { client: 'textDocument.typeHierarchy', server: 'typeHierarchyProvider' }; } /** diff --git a/protocol/src/common/protocol.workspaceFolder.ts b/protocol/src/common/protocol.workspaceFolder.ts index d9d6e1c7d..75e3de778 100644 --- a/protocol/src/common/protocol.workspaceFolder.ts +++ b/protocol/src/common/protocol.workspaceFolder.ts @@ -49,6 +49,7 @@ export namespace WorkspaceFoldersRequest { export const type = new ProtocolRequestType0(method); export type HandlerSignature = RequestHandler0; export type MiddlewareSignature = (token: CancellationToken, next: HandlerSignature) => HandlerResult; + export const capabilities: { client: 'workspace.workspaceFolders'; server: 'workspace.workspaceFolders' } = { client: 'workspace.workspaceFolders', server: 'workspace.workspaceFolders' }; } /** @@ -61,6 +62,7 @@ export namespace DidChangeWorkspaceFoldersNotification { export const type = new ProtocolNotificationType(method); export type HandlerSignature = NotificationHandler; export type MiddlewareSignature = (params: DidChangeWorkspaceFoldersParams, next: HandlerSignature) => void; + export const capabilities: { server: 'workspace.workspaceFolders.changeNotifications' } = { server: 'workspace.workspaceFolders.changeNotifications' }; } /** diff --git a/tools/src/metaModel.ts b/tools/src/metaModel.ts index 3b4091e54..2516dd22c 100644 --- a/tools/src/metaModel.ts +++ b/tools/src/metaModel.ts @@ -202,6 +202,16 @@ export type Request = { * the property contains the deprecation message. */ deprecated?: string; + + /** + * The client capability property path if any. + */ + clientCapability?: string; + + /** + * The server capability property path if any. + */ + serverCapability?: string; }; /** @@ -269,6 +279,16 @@ export type Notification = { * the property contains the deprecation message. */ deprecated?: string; + + /** + * The client capability property path if any. + */ + clientCapability?: string; + + /** + * The server capability property path if any. + */ + serverCapability?: string; }; /** diff --git a/tools/src/visitor.ts b/tools/src/visitor.ts index 8088d73fa..f01473f0a 100644 --- a/tools/src/visitor.ts +++ b/tools/src/visitor.ts @@ -151,6 +151,8 @@ namespace MessageDirection { } } +type Capabilities = { clientCapability?: string; serverCapability?: string }; + export default class Visitor { private readonly program: ts.Program; @@ -345,6 +347,9 @@ export default class Visitor { result: TypeInfo.isVoid(requestTypes.result) ? TypeInfo.asJsonType({ kind: 'base', name: 'null' }) : TypeInfo.asJsonType(requestTypes.result), messageDirection: this.getMessageDirection(symbol) }; + const capabilities = this.getCapabilities(symbol); + result.clientCapability = capabilities?.clientCapability; + result.serverCapability = capabilities?.serverCapability; result.params = requestTypes.param !== undefined ? asJsonType(requestTypes.param) : undefined; result.partialResult = asJsonType(requestTypes.partialResult); result.errorData = asJsonType(requestTypes.errorData); @@ -384,6 +389,9 @@ export default class Visitor { typeName: symbol.name, messageDirection: this.getMessageDirection(symbol) }; + const capabilities = this.getCapabilities(symbol); + result.clientCapability = capabilities?.clientCapability; + result.serverCapability = capabilities?.serverCapability; result.params = notificationTypes.param !== undefined ? asJsonType(notificationTypes.param) : undefined; result.registrationMethod = this.getRegistrationMethodName(symbol); result.registrationOptions = asJsonType(notificationTypes.registrationOptions); @@ -576,6 +584,38 @@ export default class Visitor { return undefined; } + private getCapabilities(namespace: ts.Symbol): Capabilities | undefined { + const capabilities = namespace.exports?.get('capabilities' as ts.__String); + if (capabilities === undefined) { + return undefined; + } + const declaration = this.getFirstDeclaration(capabilities); + if (declaration === undefined) { + return undefined; + } + if (!ts.isVariableDeclaration(declaration)) { + return undefined; + } + const initializer = declaration.initializer; + if (initializer === undefined || !ts.isObjectLiteralExpression(initializer)) { + return undefined; + } + const result: Capabilities = {}; + const clientCapability = initializer.properties.find(property => + ts.isPropertyAssignment(property) && property.name.getText() === 'client' + ) as ts.PropertyAssignment | undefined; + if (clientCapability !== undefined && ts.isStringLiteral(clientCapability.initializer)) { + result.clientCapability = this.removeQuotes(clientCapability.initializer.getText()); + } + const serverCapability = initializer.properties.find(property => + ts.isPropertyAssignment(property) && property.name.getText() === 'server' + ) as ts.PropertyAssignment | undefined; + if (serverCapability !== undefined && ts.isStringLiteral(serverCapability.initializer)) { + result.serverCapability = this.removeQuotes(serverCapability.initializer.getText()); + } + return result; + } + private getNotificationTypes(symbol: ts.Symbol): NotificationTypes | undefined { const declaration = this.getFirstDeclaration(symbol); if (declaration === undefined) { @@ -1326,4 +1366,4 @@ namespace PreDefined { documentation: 'A document selector is the combination of one or many document filters.\n\n@sample `let sel:DocumentSelector = [{ language: \'typescript\' }, { language: \'json\', pattern: \'**∕tsconfig.json\' }]`;\n\nThe use of a string as a document filter is deprecated @since 3.16.0.', since: '3.16.0.' }; -} \ No newline at end of file +}