Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit b781d2b

Browse files
committed
Implement internal Ruby activation mechanism
1 parent 91e3134 commit b781d2b

14 files changed

+833
-444
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,31 @@ jobs:
3636
node-version: "18"
3737
cache: "yarn"
3838

39-
# We need some Ruby installed for the environment activation tests
39+
# We need some Ruby installed for the environment activation tests. The Ruby version installed here needs to match
40+
# the one we're using the ruby.test.ts file
4041
- name: Set up Ruby
4142
uses: ruby/setup-ruby@v1
4243
with:
43-
ruby-version: "3.3"
44+
ruby-version: "3.3.0"
45+
46+
# On GitHub actions, the Ruby binary is installed in a path that's not really standard for version managers. We
47+
# create a symlink using a standard path so that we test the same behaviour as in development machines
48+
- name: Symlink Ruby on Ubuntu
49+
if: matrix.os == 'ubuntu-latest'
50+
run: |
51+
mkdir /opt/rubies
52+
ln -s /opt/hostedtoolcache/Ruby/3.3.0/x64 /opt/rubies/3.3.0
53+
54+
- name: Symlink Ruby on MacOS
55+
if: matrix.os == 'macos-latest'
56+
run: |
57+
mkdir /Users/runner/.rubies
58+
ln -s /Users/runner/hostedtoolcache/Ruby/3.3.0/x64 /Users/runner/.rubies/3.3.0
59+
60+
- name: Symlink Ruby on Windows
61+
if: matrix.os == 'windows-latest'
62+
run: |
63+
New-Item -Path C:\Ruby33-x64 -ItemType SymbolicLink -Value C:\hostedtoolcache\windows\Ruby\3.3.0\x64
4464
4565
- name: 📦 Install dependencies
4666
run: yarn --frozen-lockfile

package.json

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "ruby-lsp",
33
"displayName": "Ruby LSP",
44
"description": "VS Code plugin for connecting with the Ruby LSP",
5-
"version": "0.5.9",
5+
"version": "0.6.8",
66
"publisher": "Shopify",
77
"repository": {
88
"type": "git",
@@ -57,8 +57,8 @@
5757
"category": "Ruby LSP"
5858
},
5959
{
60-
"command": "rubyLsp.selectRubyVersionManager",
61-
"title": "Select Ruby version manager",
60+
"command": "rubyLsp.changeRubyVersion",
61+
"title": "Change Ruby version",
6262
"category": "Ruby LSP"
6363
},
6464
{
@@ -244,30 +244,6 @@
244244
}
245245
}
246246
},
247-
"rubyLsp.rubyVersionManager": {
248-
"description": "The Ruby version manager to use",
249-
"type": "string",
250-
"enum": [
251-
"asdf",
252-
"auto",
253-
"chruby",
254-
"none",
255-
"rbenv",
256-
"rvm",
257-
"shadowenv",
258-
"custom"
259-
],
260-
"default": "auto"
261-
},
262-
"rubyLsp.customRubyCommand": {
263-
"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'",
264-
"type": "string"
265-
},
266-
"rubyLsp.yjit": {
267-
"description": "Use YJIT to speed up the Ruby LSP server",
268-
"type": "boolean",
269-
"default": true
270-
},
271247
"rubyLsp.formatter": {
272248
"description": "Which tool the Ruby LSP should use for formatting files",
273249
"type": "string",
@@ -289,6 +265,11 @@
289265
"type": "integer",
290266
"default": 30
291267
},
268+
"rubyLsp.rubyExecutablePath": {
269+
"description": "Specify the path for a Ruby executable to use for the Ruby LSP server on all projects",
270+
"type": "string",
271+
"default": ""
272+
},
292273
"rubyLsp.branch": {
293274
"description": "Run the Ruby LSP server from the specified branch rather than using the released gem. Only supported if not using bundleGemfile",
294275
"type": "string",
@@ -494,6 +475,7 @@
494475
"@types/glob": "^8.1.0",
495476
"@types/mocha": "^10.0.6",
496477
"@types/node": "20.x",
478+
"@types/sinon": "^17.0.3",
497479
"@types/vscode": "^1.68.0",
498480
"@typescript-eslint/eslint-plugin": "^5.62.0",
499481
"@typescript-eslint/parser": "^5.62.0",
@@ -507,6 +489,7 @@
507489
"mocha": "^10.2.0",
508490
"ovsx": "^0.8.3",
509491
"prettier": "^3.2.5",
492+
"sinon": "^17.0.1",
510493
"typescript": "^5.3.3",
511494
"vscode-oniguruma": "^2.0.1",
512495
"vscode-textmate": "^9.0.0"

src/common.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ export enum Command {
1212
Update = "rubyLsp.update",
1313
ToggleExperimentalFeatures = "rubyLsp.toggleExperimentalFeatures",
1414
ServerOptions = "rubyLsp.serverOptions",
15-
ToggleYjit = "rubyLsp.toggleYjit",
16-
SelectVersionManager = "rubyLsp.selectRubyVersionManager",
15+
ChangeRubyVersion = "rubyLsp.changeRubyVersion",
1716
ToggleFeatures = "rubyLsp.toggleFeatures",
1817
FormatterHelp = "rubyLsp.formatterHelp",
1918
RunTest = "rubyLsp.runTest",
@@ -24,10 +23,8 @@ export enum Command {
2423
}
2524

2625
export interface RubyInterface {
27-
error: boolean;
28-
versionManager?: string;
2926
rubyVersion?: string;
30-
supportsYjit?: boolean;
27+
yjitEnabled?: boolean;
3128
}
3229

3330
export interface ClientInterface {

0 commit comments

Comments
 (0)