Quantcast
Channel: ruby - Madogiwa Blog
Viewing all articles
Browse latest Browse all 42

VSCodeの`rebornix.ruby`から`shopify.ruby-lsp`に乗り換えるメモ

$
0
0

今までVSCodeRubyを使うときにはrebornix.rubyを使うことが多かったと思うのですが、

marketplace.visualstudio.com

現状は非推奨となっており、

Shopify's ruby-lsp and associated vscode-ruby-lsp are recommended alternatives to this extension. It is substantially easier to produce a high-quality LSP implementation using Ruby itself vs relying on another language such as TypeScript. GitHub - rubyide/vscode-ruby: Provides Ruby language and debugging support for Visual Studio Code

推奨されているshopify.ruby-lspに乗り換えてみたのでメモ📝

marketplace.visualstudio.com

乗り換えは簡単でVSCode拡張機能からinstallした後にGemfileにruby-lspを追加してbundle installすれば大丈夫でした🙆‍♂️

group :developmentdogem"ruby-lsp"

Gemfileに入れないとエラーになったのでGemfileに入れましたが、公式のReadme的には起動時に.ruby-lsp配下にGemfileが追加されてよしなに利用されるため不要なようです。(自分はなぜか動かなかった・・・)

NOTE: starting with v0.7.0, it is no longer recommended to add the ruby-lsp to the bundle. The gem will generate a custom bundle in .ruby-lsp/Gemfile which is used to identify the versions of dependencies that should be used for the application (e.g.: the correct RuboCop version).
GitHub - Shopify/ruby-lsp: An opinionated language server for Ruby

あとは私はrubocopじゃなくてstarndardrbを利用しているのですが、Ruby LSPが出すrubocopの警告は不要のためdiagnosticsfalseにしました。

"rubyLsp.enabledFeatures": {"diagnostics": false,

これでいい感じにコードジャンプ等が動くようになりました💎

あとrails用のもあるらしい。

github.com

ShopfyこういったRubyの基盤的な技術もOSSで提供してくれていてありがたい🙏

参考)

code.visualstudio.com


Viewing all articles
Browse latest Browse all 42

Trending Articles