Skip to content

Support per-folder enable/disable for the singleton server in multi-root workspaces#62

Draft
edvilme with Copilot wants to merge 2 commits into
mainfrom
copilot/support-singleton-server-instance
Draft

Support per-folder enable/disable for the singleton server in multi-root workspaces#62
edvilme with Copilot wants to merge 2 commits into
mainfrom
copilot/support-singleton-server-instance

Conversation

Copilot AI commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Tool extensions consuming this library risk redundant LSP processes and duplicated diagnostics in multi-root workspaces. The TypeScript client already runs a singleton server (one client rooted at getProjectRoot(), per-folder settings forwarded via getExtensionSettings()), so the gap was the lack of a per-folder opt-out (e.g. pylint.enabled: false for a single folder).

Changes

  • settings.ts
    • isToolEnabledForWorkspace(namespace, workspace?, settingKey?) — reads the per-folder <namespace>.enabled boolean; defaults to enabled, settingKey overridable (e.g. 'enable').
    • getEnabledWorkspaceFolders(namespace, settingKey?) — folders for which the tool is enabled.
    • getExtensionSettings() now resolves settings only for enabled folders, so the shared server never lints opted-out folders. Backward compatible: unset → enabled.
  • index.ts — export the two new helpers.
  • Tests — cover default-enabled, explicit disable, custom setting key, and folder filtering through getExtensionSettings.
  • README — document the singleton model and per-folder enable API.

Example

// Disabled folders are omitted; the singleton server only receives enabled ones.
const settings = await getExtensionSettings('pylint', toolConfig, resolveInterpreter);

// Or query directly when registering per-folder providers:
const folders = getEnabledWorkspaceFolders('pylint');
const enabled = isToolEnabledForWorkspace('pylint', folder, 'enable');

Note: getExtensionSettings() filtering changes which folders reach the server when a tool exposes an enabled setting and a user disables a folder — worth a careful look during review, though defaults preserve existing behavior.

Copilot AI changed the title [WIP] Add support for singleton server instance in multi-root workspaces Support per-folder enable/disable for the singleton server in multi-root workspaces Jun 17, 2026
Copilot AI requested a review from edvilme June 17, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants