From 983b380980da9dc4bb6969578c340ee65ea635f1 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Tue, 29 Oct 2024 11:21:39 +0000 Subject: [PATCH 1/2] Add vscode-lldb to recommended extensions list --- .vscode/extensions.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 92cbaf25abf..839ce4bcbf9 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,7 +1,9 @@ { "recommendations": [ // C++ intellisense with clangd. - "llvm-vs-code-extensions.vscode-clangd" + "llvm-vs-code-extensions.vscode-clangd", + // TODO: remove this before upstreaming + "vadimcn.vscode-lldb", ], "unwantedRecommendations": [ // Microsoft C++ intellisense (doesn't work properly with Sorbet) From bab4eb4ad45e12771b156f9f678493bfa1e7da56 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Tue, 29 Oct 2024 13:03:08 +0000 Subject: [PATCH 2/2] Add support for debugging Prism tests in VSCode --- .vscode/launch.json | 22 +++++++++++++++++++++- .vscode/tasks.json | 17 +++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index cf214db59d2..640062c2b12 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -22,6 +22,26 @@ "ignoreFailures": false } ] + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug Prism test in LLDB", + "program": "${workspaceFolder}/bazel-bin/test/test_PosTests/prism_regression/${input:test_name}.runfiles/com_stripe_ruby_typer/test/pipeline_test_runner", + "args": ["--single_test=${workspaceFolder}/test/prism_regression/${input:test_name}.rb", "--parser=prism"], + // See .vscode/tasks.json for the task that sets the `BAZEL_EXEC_ROOT` environment variable. + "preLaunchTask": "Prepare tests debugging", + "stopOnEntry": false, + "sourceMap": { + "${env:BAZEL_EXEC_ROOT}": "${workspaceFolder}", + }, + }, + ], + "inputs": [ + { + "id": "test_name", + "type": "promptString", + "description": "Enter the test name, e.g. case for running test/prism_regression/case.rb", } ] -} \ No newline at end of file +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 2a94107f760..bf42f913888 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -69,6 +69,23 @@ "reveal": "always" } }, + // This task: + // - Runs tests to generate the pipeline_test_runner files, which are needed by the LLDB + // debugger to execute the tests. + // - Sets the `BAZEL_EXEC_ROOT` environment variable, which is used by the LLDB + // debugger to find the source files. + { + "label": "Prepare tests debugging", + "type": "shell", + "command": "export BAZEL_EXEC_ROOT=$(./bazel info execution_root)", + // We need to run tests first to get the pipeline_test_runner files generated + // Just building Sorbet with Prism doesn't generate them. + "dependsOn": ["Run all Prism tests"], + "hide": true, + "presentation": { + "reveal": "never", + } + } ], "inputs": [ {