VSCode Ruby設定
#VSCode
Extension
Ruby
Ruby LSP(Shopify)
ruby-rubocop
endwise
rails go to spec
VSCode rdbg Ruby Debugger
コードジャンプ
Ruby: VSCodeの開発環境を整える・コードジャンプできるように
Intellisenseを false から rubyLocate に変更
RuboCopを自動実行
VS Code で自動的に RuboCop を実行する
RubyをVSCodeでデバッグ
rspec
Visual Studio Code で rspec 実行
specファイルと実装ファイルとを行き来できる
cmd shift y
Tasks: Rerun Last Taskにcontrol + xを割り当てる
tasks.jsonに以下を記述
code:json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "rspec file",
"type": "shell",
"command": "rspec -fd ${relativeFile}",
"group": "test",
"problemMatcher": [
{
"owner": "ruby",
"fileLocation": "relative", "${workspaceFolder}",
"pattern": {
"regexp": "^rspec\\s+(.*):(\\d+)\\s+#\\s+(.*)$",
"file": 1,
"line": 2,
"message": 3
}
}
]
},
{
"label": "rspec here",
"type": "shell",
"command": "rspec -fd ${relativeFile}:${lineNumber}",
"group": "test",
"problemMatcher": [
{
"owner": "ruby",
"fileLocation": "relative", "${workspaceFolder}",
"pattern": {
"regexp": "^rspec\\s+(.*):(\\d+)\\s+#\\s+(.*)$",
"file": 1,
"line": 2,
"message": 3
}
}
]
}
]
}
RSpecのテスト概要を見る
Ruby Test Explorer
Rubocopの設定でフォーマットする
vscodeでrubocopを使ってrubyをフォーマット(mac編) - Qiita