Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use vscode-js-debug as the debugger implementation #1001

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

jwajgelt
Copy link
Contributor

@jwajgelt jwajgelt commented Mar 3, 2025

Uses js-debug's implementation of the JS debugger for targets which support it (Hermes with RN version >= 0.76).
This allows us to use the features already implemented there (exception breakpoints, conditional breakpoints) without having to reimplement them, and possibly allows us to remove our CDP debugger implementation in the future, once we drop support for the older RN versions.

We patch vscode-js-debug in order to:

  • create a new session type used by Radon, based on js-debug's node debug session type
  • disable the debug toolbar for that session
  • disable the use of proposed vscode extension APIs which prevent the extension from building

We use the vscode-cdp-proxy package for implementing the CDP proxy sitting between the js-debug debugger implementation and the application.
We patch it to:

  • fix a bug which incorrectly treats CDP commands as replies when they include the id field
  • fix a bug which exports an nonexistent module from the package

How Has This Been Tested:

  • launch various apps from test-apps repo
  • verify that in each app, the debugger still works, and:
    • the debugger toolbar doesn't appear (we provide our own controls when a breakpoint is hit)
    • you can set "caught/uncaught exception" breakpoints and they work
    • setting regular breakpoints work correctly
    • setting conditional breakpoints work
    • logs are routed to the debug console
    • pausing inside RN code works correctly (i.e. when handling caught exceptions)
    • running the CPU profiler works and maps the source locations correctly

Copy link

vercel bot commented Mar 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
radon-ide ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 9:27am

jwajgelt added a commit that referenced this pull request Mar 7, 2025
Refactors the changes introduced in #964 to separate logging metro
messages and JS debugging into separate DAP Sessions. This will also
make integrating #1001 easier with other changes made to `DebugAdapter`.

### How Has This Been Tested: 
Open an app and check the debugger still works correctly:
- breakpoints and uncaught errors should still stop the application
- debugger controls in the preview should resume/step over breakpoints
- check profiling still works
- check if Metro errors are logged to the debug console.
@jwajgelt jwajgelt marked this pull request as ready for review March 10, 2025 10:03
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.

1 participant