aspect-build / aspect-build/rules_js
[FR]: Pleasant VS Code debugging experience
- Dominant language
- Starlark
- Stars
- 378
- Forks
- 183
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 32
Description
### What is the current behavior?
https://github.com/aspect-build/rules_js/blob/main/docs/README.md#debugging describes how to use VS step-through debuggers with rules_js.
There are a few annoying aspects:
1. Setup is required in .bazelrc and VS Code.
2. The build target must be launched independently from the VS Code debugger. That is, first the user runs `bazel run --config=debug //:foo`; then, the user runs launches the "Attach nodejs_binary" configuration.
3. Due to 2, when the user wants to rerun a program, it takes 30s or so. With typical VS Code debugging, the "Debug: Restart" command can be used (a single button click).
4. The debugger doesn't recognize breakpoints set in the original source files, and the copies of these source files in bazel-bin are used instead.
### Describe the feature
VS Code debugging of bazel targets should be approximately as easy as debugging normal TypeScript/JavaScript projects. I want to specify either a test or binary target, hit the debug button, and debug as usual.
---
Implementation notes
Perhaps source maps should be emitted when source files are copied to the output, or symlinks to the source directory should be used instead (if supported) when using the debug bazel config.
Documentation on how VS Code's debugger uses source maps:
https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_source-map-discovery
### Fund our work
- [ ] Sponsor our open source work by donating a [feature bounty](https://opencollective.com/aspect-build/)
Contributor guide
Research direction
Start with the debugging section of docs/README.md and reproduce the current .bazelrc and VS Code setup using the documented `bazel run --config=debug //:foo` flow. Compare the current attach configuration with the requested experience: launching a test or binary from VS Code, restarting quickly, and recognizing breakpoints in the original source files. Review the linked VS Code source-map documentation for the expected debugger behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript, vscode
- Domain
- build-system, developer-experience, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100