Skip to content

lspeasy / core/src / getCapabilityForRequestMethod

Function: getCapabilityForRequestMethod()

ts
function getCapabilityForRequestMethod<M, D>(method, _direction?): 
  | InternalPaths<Required<ServerCapabilities<any>>, {
  bracketNotation: false;
  depth: number;
  leavesOnly: false;
  maxRecursionDepth: 5;
}, 0>
  | "alwaysOn";

Defined in: packages/core/src/protocol/infer.ts:220

Get the server capability key for a given request method at runtime.

Type Parameters

Type ParameterDefault type
M extends | "callHierarchy/incomingCalls" | "callHierarchy/outgoingCalls" | "client/registerCapability" | "client/unregisterCapability" | "codeAction/resolve" | "codeLens/resolve" | "completionItem/resolve" | "documentLink/resolve" | "inlayHint/resolve" | "initialize" | "shutdown" | "textDocument/codeAction" | "textDocument/codeLens" | "textDocument/documentLink" | "textDocument/inlayHint" | "textDocument/implementation" | "textDocument/typeDefinition" | "textDocument/documentColor" | "textDocument/colorPresentation" | "textDocument/foldingRange" | "textDocument/declaration" | "textDocument/selectionRange" | "textDocument/prepareCallHierarchy" | "textDocument/semanticTokens/full" | "textDocument/semanticTokens/full/delta" | "textDocument/semanticTokens/range" | "textDocument/linkedEditingRange" | "textDocument/moniker" | "textDocument/prepareTypeHierarchy" | "textDocument/inlineValue" | "textDocument/diagnostic" | "textDocument/willSaveWaitUntil" | "textDocument/completion" | "textDocument/hover" | "textDocument/signatureHelp" | "textDocument/definition" | "textDocument/references" | "textDocument/documentHighlight" | "textDocument/documentSymbol" | "textDocument/formatting" | "textDocument/rangeFormatting" | "textDocument/onTypeFormatting" | "textDocument/rename" | "textDocument/prepareRename" | "typeHierarchy/supertypes" | "typeHierarchy/subtypes" | "window/workDoneProgress/create" | "window/showDocument" | "window/showMessageRequest" | "workspace/willCreateFiles" | "workspace/willRenameFiles" | "workspace/willDeleteFiles" | "workspace/diagnostic" | "workspace/symbol" | "workspace/executeCommand" | "workspace/workspaceFolders" | "workspace/configuration" | "workspace/semanticTokens/refresh" | "workspace/inlineValue/refresh" | "workspace/inlayHint/refresh" | "workspace/diagnostic/refresh" | "workspace/codeLens/refresh" | "workspace/applyEdit" | "workspaceSymbol/resolve"-
D extends "both" | "clientToServer" | "serverToClient""both"

Parameters

ParameterTypeDescription
methodMThe LSP request method string to look up.
_directionDOptional direction filter (currently unused).

Returns

| InternalPaths<Required<ServerCapabilities<any>>, { bracketNotation: false; depth: number; leavesOnly: false; maxRecursionDepth: 5; }, 0> | "alwaysOn"

The dot-notation capability path, or 'alwaysOn' if no capability gate exists.

Released under the MIT License.