Skip to content

lspeasy / core/src / getCapabilityForNotificationMethod

Function: getCapabilityForNotificationMethod()

ts
function getCapabilityForNotificationMethod<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:250

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

Type Parameters

Type ParameterDefault type
M extends | "initialized" | "exit" | "textDocument/didOpen" | "textDocument/didChange" | "textDocument/didClose" | "textDocument/didSave" | "textDocument/willSave" | "textDocument/publishDiagnostics" | "window/showMessage" | "window/workDoneProgress/cancel" | "window/logMessage" | "workspace/didChangeWorkspaceFolders" | "workspace/didCreateFiles" | "workspace/didRenameFiles" | "workspace/didDeleteFiles" | "workspace/didChangeConfiguration" | "workspace/didChangeWatchedFiles" | "$/cancelRequest" | "$/progress" | "$/setTrace" | "$/logTrace" | "notebookDocument/didOpen" | "notebookDocument/didChange" | "notebookDocument/didSave" | "notebookDocument/didClose" | "telemetry/event"-
D extends "both" | "clientToServer" | "serverToClient""both"

Parameters

ParameterTypeDescription
methodMThe LSP notification 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.