Skip to content

Conversation

@albertleigh
Copy link
Contributor

@albertleigh albertleigh commented Jan 23, 2026

Hi Reviewers,

I am a fan of boa, and I think I could help with a DAP debugger for boa.

This PR adds initial IDE debugging support to Boa CLI through the Debug Adapter Protocol (DAP), enabling developers to debug JavaScript code running in Boa using VS Code or any other DAP-compatible IDE.

Everything was hidden begind core/debugger and cli/dap features, they should not impact the current performance I believed.

And I think it would be a good time to talk about high-level stuffs like:

  • we would like core to maintain most of the debug state like spidermonkey
  • or boa-cli should not do too much.
  • some file/struct were terrible named as Al is an alien. 🤣
  • there should be a better way/place for dbg_log! marco
    then we could settle places to pour more dap message and test again boa engine.

So I just put minimum changes to support debugger instruction and pause and support to resume like:

We could try it like:

  1. Build a cli of dap features: cargo.exe build --message-format=json-diagnostic-rendered-ansi --color=always --bin boa --features default,dap --profile dev --manifest-path boa\cli\Cargo.toml
  2. Before we starting boa-cli, we could set BOA_DAP_DEBUG=1 to allow log some dap events to the console for tracing.
  3. [Optional] we could first start the boa in your IDE rather than extension.js starting one for you and we have to attache debugger to its exe latter. /boa/target/debug/boa.exe --dap 4711
  4. change directory to tools/vscode-boa-debug and code . there and run a light weight extension with the task Run Extension
  5. So should have another VSC about to run the extension.js open and use this VSC open the folder tools/vscode-boa-debug/test-files, then run the task Test Boa Debugger.
  6. Make no mistake we should reached the happy path like the clip that I attached:
Code_4UOweCvO8o.mp4

Not sure we like this DAP idea or not, maybe too early for boa. I am not that sure. Should Al continue on it? Maybe Al could use it as another starting point and help boa better with more and more features.

Like:

  • We could add this https://nekevss.github.io/boa-debugger/ as a side view in the extension.
  • We could gradually enhance our source line mapping to become more accurate while integrating DAP
  • We could release boa via a vsc extension latter.

Let Al know whether boa like DAP ~

Thanks

ps:
I noticed we got:
#3978
#4510

Dont be so serious with the markdowns in this pr, I generate with AI
core/engine/src/debugger/README.MD

@github-actions
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 52,598 52,598 0
Passed 49,421 49,421 0
Ignored 2,134 2,134 0
Failed 1,043 1,043 0
Panics 0 0 0
Conformance 93.96% 93.96% 0.00%

@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 0.52356% with 190 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.19%. Comparing base (6ddc2b4) to head (be78083).
⚠️ Report is 632 commits behind head on main.

Files with missing lines Patch % Lines
cli/src/debug/dap.rs 0.00% 164 Missing ⚠️
core/engine/src/context/hooks.rs 0.00% 10 Missing ⚠️
core/engine/src/vm/opcode/debugger/mod.rs 0.00% 6 Missing ⚠️
core/engine/src/vm/code_block.rs 0.00% 5 Missing ⚠️
core/engine/src/bytecompiler/statement/mod.rs 33.33% 2 Missing ⚠️
core/engine/src/debugger/hooks.rs 0.00% 2 Missing ⚠️
core/engine/src/vm/flowgraph/mod.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4586      +/-   ##
==========================================
+ Coverage   47.24%   56.19%   +8.95%     
==========================================
  Files         476      550      +74     
  Lines       46892    60243   +13351     
==========================================
+ Hits        22154    33854   +11700     
- Misses      24738    26389    +1651     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@albertleigh albertleigh changed the title Add Debug Adapter Protocol (DAP) Support to Boa Add Debug Adapter Protocol (DAP) Initial Support to Boa Jan 23, 2026
@albertleigh albertleigh changed the title Add Debug Adapter Protocol (DAP) Initial Support to Boa Add Initial Debug Adapter Protocol (DAP) Support to Boa Jan 23, 2026
@albertleigh albertleigh marked this pull request as ready for review January 23, 2026 08:01
@jedel1043
Copy link
Member

jedel1043 commented Jan 23, 2026

Please don't open PRs with 9k new lines of code.

@jedel1043 jedel1043 closed this Jan 23, 2026
@albertleigh
Copy link
Contributor Author

okay 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants