Shopify / Shopify/ruby-lsp

Unable to Start Ruby-LSP with VS Code and WSL2

Open
#2,580 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug help-wanted pinned vscode
Dominant language
Ruby
Stars
2k
Forks
281
Avg merge
2h 14m
Merged PRs (30d)
6

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported Ruby executable command in the VS Code, WSL2, Ubuntu, and rbenv setup described in the issue. Trace the Ruby executable discovery and manual configuration path using the reported rubyExecutablePath, then verify that Ruby LSP starts instead of reporting an undefined Ruby version.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.