Navigate to Ruby function definition in VS Code

Thanks to Chris’s suggestion, I got a better error message. Following that lead, I found that Ruby’s code navigation seems to require a second language server: solargraph. I don’t know if you require both, but I can now navigate to Ruby definitions. I also have to autocomplete working.

Update [2022]

Coming back to this with VSCode 1.67.0 on Ubuntu 22.04, I no longer require solargraph. However, I did struggle a bit to figure out the exact steps to get it working:

  1. Open File: Preferences: Extensions.

  2. Search for Ruby by Peng Lv, and install it.

  3. Open File: Preferences: Settings.

  4. Click the button in the top right to open the JSON settings file:
    enter image description here

  5. Add these settings:

    {
        "ruby.useLanguageServer": true,
        "ruby.intellisense": "rubyLocate"
    }
    
  6. Restart VSCode.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)