TheOdinProject / curriculum

The open curriculum for learning web development
https://www.theodinproject.com/
Other
9.66k stars 13.1k forks source link

<Ruby>: <Suggest to use Solargraph instead of RubyLSP> #28709

Open SumonGFC opened 2 weeks ago

SumonGFC commented 2 weeks ago

Checks

Describe your suggestion

An issue that has often come up in discord conversations is getting RubyLSP to work in VScode. Although it does work 'out of the box' most of the time, people run into issues triggering it, getting it to work with RuboCop, and people also are let down by the fact that RubyLSP does not provide support (yet?) for core and standard library completion/intellisense.

I think it might be better to suggest that we install and use solargraph instead of RubyLSP (or perhaps use both). It has been my experience that installing and using solargraph is much smoother than RubyLSP.

Relevant lessons (there are 4):

  1. https://www.theodinproject.com/lessons/ruby-installing-ruby#extras
  2. https://www.theodinproject.com/lessons/ruby-debugging#assignment (part 3)
  3. https://www.theodinproject.com/lessons/ruby-project-management#ruby-lsp-in-vscode
  4. https://www.theodinproject.com/lessons/ruby-linting-and-rubocop#wouldnt-it-be-nice-to-have-all-this-in-vsc

(edit: added fourth link above)

Path

Ruby / Rails

Lesson Url

https://www.theodinproject.com/lessons/ruby-installing-ruby#extras

(Optional) Discord Name

Chindiana Jones

(Optional) Additional Comments

Discord Conversations about RubyLSP being confusing: https://discord.com/channels/505093832157691914/543074220691947531/1278014060167827496 https://discord.com/channels/505093832157691914/543074220691947531/1273651382313943174 https://discord.com/channels/505093832157691914/543074220691947531/1269495926045671474 https://discord.com/channels/505093832157691914/543074220691947531/1264966293048528936 https://discord.com/channels/505093832157691914/543074220691947531/1254073666619047936 https://discord.com/channels/505093832157691914/543074220691947531/1249058145284788365

JoshDevHub commented 2 weeks ago

Is solargraph still able to transmit suggestions, diagnostics, etc. to VSCode when there isn't a maintained VSCode plugin to support it?

SumonGFC commented 2 weeks ago

@JoshDevHub Admittedly, I didn't check this because I don't even use VSCode (I'm obliged to tell you I use neovim btw). But I really should have.

The solargraph vscode extension is able to transmit diagnostics to the editor. It does require 2 configuration steps however: making a solargraph.yml configuration file and adding rubocop as a reporter, and adding solargraph.diagnostics: true to user JSON settings. This does mean that rubocop is required for diagnostics (as far as I have been able to see).

The RubyLSP extension does feel like it has better linting and diagnostics compared to the solargraph extension, does not require rubocop gem to emit warnings/errors/etc., and the semantic highlighting is also really nice. This, in addition to the comment in this rejected PR that I just found, https://github.com/TheOdinProject/curriculum/pull/22445 , makes me think that solargraph is actually not the way to go.

Instead, to address the common "how do i get ruby-lsp to work" questions, it would probably be a good idea to add a section in the "Installing Ruby" lesson about how to set-up and trigger Ruby-LSP in VSCode. Currently, the "Installing Ruby" lesson just mentions the extension as an "Extra" thing to install if they want.