brew install rbenv
rbenv install 2.6.3
rbenv global 2.6.3
rbenv init
gem install ruby-debug-ide
gem install rcodetools
gem install solargraph
echo $PATH
然后给vscode添加一个config
设置launch.json
把echo $PATH的结果放到env的PATH里
可能还需要下面的配置
{
"window.zoomLevel": 0,
"ruby.codeCompletion": "rcodetools",
"ruby.format": "rubocop",
"ruby.intellisense": "rubyLocate",
"ruby.useLanguageServer": true,
"ruby.useBundler": true,
"ruby.pathToBundler": "~/.rbenv/shims/bundle",
"ruby.interpreter.commandPath": "ruby",
"ruby.locate": {
"exclude": "{**/@(test|spec|tmp|.*),**/@(test|spec|tmp|.*)/**,**/*_spec.rb}",
"include": "**/*.rb"
},
"ruby.rctComplete.commandPath": "~/.rbenv/shims/rct-complete",
"solargraph.autoformat": true,
"solargraph.bundlerPath": "~/.rbenv/shims/bundle",
"solargraph.formatting": true,
"solargraph.commandPath": "~/.rbenv/shims/solargraph"
}
网友评论