by hbroadbent · 2y ago · 0 comments
I'm really excited for where some of the extensions in the article are going - the RubyLSP has been improving slowly and steadily and I'm hoping that this is the year it gets _really good_. Other extensions like the StimulusLSP are niche, but awesome, and on the Twitter thread for this article (https://twitter.com/hrrsnbbnt/status/1759900961760477681) someone even pointed me to a new ERB formatter that looks promising.
TLDR; Rails is alive and well! Ruby has never been a first-class citizen of VS Code, but there's still some awesome extensions out there to give you a decent experience. And it's getting better!
You appear to be working on projects with Sorbet (which I tried to like but found it fell short in practice, notably outside of the app use case i.e it's mostly useless when authoring a gem) so it may be a tall order to try on those. Maybe you can give RBS+Steep a shot on some small project?
RBS: https://github.com/ruby/rbs
RBS collection (for those gems that don't ship RBS signatures in `sig`, integrates with bundler): https://github.com/ruby/gem_rbs_collection
Steep: https://github.com/soutaro/steep
VS Code: https://github.com/soutaro/steep-vscode
Sublime Text: https://github.com/sublimelsp/LSP
Vim (I'm working on it): https://github.com/dense-analysis/ale/pull/4671
The process is basically `rbs prototype` or `typeprof` to generate a sig file and steep then uses that. TBH it's not that much of a chore as it sounds and already gives you good-ish results. That gives you a bunch of material to work from and progressively refine types.
Speed is very good, I didn't notice anything slow.
In the Python libraries I maintain, types are useful to anyone who installs the default Python VS Code plugin, because it gives them intellisense (but doesn't give them red squiggly lines for type errors) even if they do nothing to set up types or a typechecker.
Is that or will that be the case for Ruby/Steep?
We plan to do that at some point for the Ruby Datadog tracer public API, so that users can have intellisense and don't need to jump to the docs.