VS Code 디버깅
이 문서는 Visual Studio Code (VS Code)에서 GitLab 개발 키트 (GDK)를 사용하여 Rails 디버깅을 설정하는 방법에 대해 설명합니다.
설정하기
- 
gitlab폴더 내에서gem install debug명령을 실행하여debug젬을 설치합니다. - 
VS Code Ruby 
rdbg디버거 확장 프로그램을 설치하여 VS Code에서rdbg디버거 유형을 지원합니다. - 
GitLab 및 해당하는 루비 레일즈 서버를 자동으로 중지하고 시작하고 싶은 경우, 다음 VS Code 작업을
.vscode/tasks.json파일의 구성에 추가할 수 있습니다:{ "version": "2.0.0", "tasks": [ { "label": "start rdbg", "type": "shell", "command": "gdk stop rails-web && GITLAB_RAILS_RACK_TIMEOUT_ENABLE_LOGGING=false PUMA_SINGLE_MODE=true rdbg --open -c bin/rails server", "isBackground": true, "problemMatcher": { "owner": "rails", "pattern": { "regexp": "^.*$", }, "background": { "activeOnStart": false, "beginsPattern": "^(ok: down:).*$", "endsPattern": "^(DEBUGGER: wait for debugger connection\\.\\.\\.)$" } } } ] } - 
다음 구성을
.vscode/launch.json파일에 추가합니다:{ "version": "0.2.0", "configurations": [ { "type": "rdbg", "name": "Attach with rdbg", "request": "attach", // 별도의 터미널에서 GitLab을 수동으로 시작하고 중지하려면 다음 "preLaunchTask"를 제거하세요. "preLaunchTask": "start rdbg" } ] } 
경고:
VS Code Ruby 확장 프로그램은 올바른 루비 설치 및 적절한 rdbg 명령을 찾는 데 문제가 있을 수 있습니다. 이 경우, 위의 런치 구성에 "rdbgPath": "/home/user/.asdf/shims/ (asdf의 경우)를 추가하세요.
디버깅
필수 조건
- GDK 인스턴스가 실행 중이어야 합니다.
 
디버깅을 시작하려면 다음 중 하나를 수행하세요:
- F5를 누릅니다.
 - 
Debug: Start Debugging명령을 실행합니다. 
도움말