Skip to content

Restore window scope for several workspace specific settings#4120

Open
i10416 wants to merge 3 commits into
Shopify:mainfrom
i10416:patch-1
Open

Restore window scope for several workspace specific settings#4120
i10416 wants to merge 3 commits into
Shopify:mainfrom
i10416:patch-1

Conversation

@i10416
Copy link
Copy Markdown

@i10416 i10416 commented May 26, 2026

Motivation

With capabilities.untrustedWorkspaces.restrictedConfigurations It seems impossible to set customRubyCommand at workspace level because VS Code prevents the extension from reading the machine scope options in workspace's .vscode/settings.json.

It fails with Automatic Ruby environment activation with custom failed: Command failed: && ruby -EUTF-8:UTF-8 '/path/to/.vscode/extensions/shopify.ruby-lsp-0.10.4/activation.rb' zsh:1: parse error near &&' because the command here becomes && ruby - ....

const parsedResult = await this.runEnvActivationScript(`${this.customCommand()} && ruby`);

It is sometimes case with me to find two ruby projects use different tools to manage ruby.

This change allows users to change some workspace specific settings for each workspace.

Related to

Implementation

Change option scope from "machine" to "machine-configurable"

Automated Tests

Manual Tests

Add the following .vscode/settings.json to your workspace and enable the extension.

{
  "rubyLsp.rubyVersionManager": {
    "identifier": "custom"
  },
  "rubyLsp.customRubyCommand": "{any command of your choice}"
}

@i10416 i10416 requested a review from a team as a code owner May 26, 2026 15:22
@i10416
Copy link
Copy Markdown
Author

i10416 commented May 26, 2026

Just signed CLA

@i10416
Copy link
Copy Markdown
Author

i10416 commented May 26, 2026

BTW, this is never true because workspace.getConfiguration(...).get(...) returns default value for some primitive types;

if (customCommand === undefined) {

microsoft/vscode#123957 (comment)

It must use inspect method to detect null value.

Comment thread vscode/package.json Outdated
"description": "A shell command to activate the right Ruby version or add a custom Ruby bin folder to the PATH. Only used if rubyVersionManager is set to 'custom'",
"type": "string",
"scope": "machine"
"scope": "machine-overridable"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@i10416 i10416 changed the title Update package.json Restore window scope for several workspace specific settings May 27, 2026
Comment thread vscode/package.json
},
"rubyLsp.rubyVersionManager": {
"type": "object",
"scope": "window",
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruby version manager could be different depending on workspaces.

Comment thread vscode/package.json
"description": "A shell command to activate the right Ruby version or add a custom Ruby bin folder to the PATH. Only used if rubyVersionManager is set to 'custom'",
"type": "string",
"scope": "machine"
"scope": "window"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is safe to use window scope because untrusted workspace cannot execute command thanks to capabilities.untrustedWorkspaces options.

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.

1 participant