Skip to content

lspeasy / core/src / buildMethodSets

Function: buildMethodSets()

ts
function buildMethodSets(capabilityKey): {
  all: Set<string>;
  alwaysAllowed: Set<string>;
};

Defined in: packages/core/src/utils/capability-guard.ts:25

Builds the full set of LSP methods and the subset that are always allowed (not gated by a capability) for a given capability key.

Parameters

ParameterTypeDescription
capabilityKeyCapabilityKeyWhether to index by 'ServerCapability' or 'ClientCapability'.

Returns

ts
{
  all: Set<string>;
  alwaysAllowed: Set<string>;
}

An object with all (every known method) and alwaysAllowed (methods that do not require a capability declaration).

NameTypeDefined in
allSet<string>packages/core/src/utils/capability-guard.ts:26
alwaysAllowedSet<string>packages/core/src/utils/capability-guard.ts:27

Remarks

Iterates every entry in LSPRequest and LSPNotification to collect method strings, then marks those without a corresponding capability entry as always-allowed (e.g. initialize, shutdown, $/cancelRequest).

Released under the MIT License.