Skip to content

Unable to Start Ruby-LSP with VS Code and WSL2 #2580

Open

Description

Description

Hello There 👋

I'm just entering the wonderful world of ruby and currently I'm trying to get ruby-lsp installed on vscode. Below are the details of the error that I'm running into.

Ruby LSP Information

VS Code Version

1.93.1

Ruby LSP Extension Version

0.8.0

Ruby LSP Server Version

Unknown

Ruby LSP Addons

Ruby Version

Unknown

Ruby Version Manager

rbenv

Installed Extensions

Click to expand
  • vscode-rdbg (0.2.2)
  • vscode-docker (1.29.2)
  • ruby-extensions-pack (0.1.12)
  • ruby-lsp (0.8.0)
  • sorbet-vscode-extension (0.3.36)

Ruby LSP Settings

Click to expand
Workspace
{}
User
{
  "enableExperimentalFeatures": false,
  "enabledFeatures": {
    "codeActions": true,
    "diagnostics": true,
    "documentHighlights": true,
    "documentLink": true,
    "documentSymbols": true,
    "foldingRanges": true,
    "formatting": true,
    "hover": true,
    "inlayHint": true,
    "onTypeFormatting": true,
    "selectionRanges": true,
    "semanticHighlighting": true,
    "completion": true,
    "codeLens": true,
    "definition": true,
    "workspaceSymbol": true,
    "signatureHelp": true,
    "typeHierarchy": true
  },
  "featuresConfiguration": {},
  "addonSettings": {},
  "rubyVersionManager": {
    "identifier": "rbenv"
  },
  "customRubyCommand": "",
  "formatter": "auto",
  "linters": null,
  "bundleGemfile": "",
  "testTimeout": 30,
  "branch": "",
  "pullDiagnosticsOn": "both",
  "useBundlerCompose": false,
  "bypassTypechecker": false,
  "rubyExecutablePath": "\\\\wsl.localhost\\Ubuntu\\root\\.rbenv\\versions\\3.3.4\\bin\\ruby",
  "indexing": {},
  "erbSupport": true
}

VS Code Specs

Version: 1.93.1 (user setup)
Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
Date: 2024-09-11T17:20:05.685Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

OS Specs

Edition Windows 11 Home
Version 23H2
Installed on ‎2023-‎03-‎06
OS build 22631.4037
Serial number PF3X5QHN
Experience Windows Feature Experience Pack 1000.22700.1027.0

Ruby Version

root@Jakobslenovo:/mnt/c/Users/jake1/GameStonk# which ruby
/root/.rbenv/shims/ruby
root@Jakobslenovo:/mnt/c/Users/jake1/GameStonk# ruby --version
ruby 3.3.4 (2024-07-09 revision be1089c8ec) [x86_64-linux]
root@Jakobslenovo:/mnt/c/Users/jake1/GameStonk#

Rbenv Version

rbenv 1.1.2

WSL2 Version

WSL version: 2.2.4.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.61
MSRDC version: 1.2.5326
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26091.1-240325-1447.ge-release
Windows version: 10.0.22631.4037

Ubuntu Version

Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:        22.04
Codename:       jammy

Reproduction steps

  1. Start Up VS Code with WSL2 terminal
  2. Open a Ruby file
  3. ruby-lsp status mentions "Using Ruby undefined with rbenv"
  4. Select "Change manual ruby configuration", then select path to ruby binary as directed
  5. See the following error pop up in VS Code:
Command failed: \\wsl.localhost\Ubuntu\root\.rbenv\versions\3.3.4\bin\ruby -W0 -rjson -e 'STDERR.print({ env: ENV.to_h, yjit: !!defined?(RubyVM::YJIT), version: RUBY_VERSION }.to_json)'

I've confirmed that the ruby-lsp gem is installed but I've had no luck starting up the lsp. It keeps prompting me to point to the path of the ruby binary I want to use but I continually get the same error above. Any help is much appreciated!

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugSomething isn't workingvscodeThis pull request should be included in the VS Code extension's release notes

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions