software-mansion / radon-ide

VSCode extension that turns your editor into a fully fledged IDE for React Native and Expo.
https://ide.swmansion.com
Other
998 stars 35 forks source link

Refactor debug adapter #755

Closed filip131311 closed 1 day ago

filip131311 commented 3 days ago

This PR refactors debug adapter to handle two issues: (1) - the debugAdapter.ts - file was becoming hard to manage due to it's versatility of use (2) - solve problems with multiple sources triggering breakpoint updates at the same time

to solve (1) we separate out: CDPSession, SourceMapController and breakpointsController to solve (2) we do the following:

a) move the responsibility of updating the breakpoints from breakpointsController to CDPBreakpoint class itself and queue CDP communication associated with that breakpoint such that we never request to set breakpoint with CDP until we get a response from previous breakpoint b) we clear breakpoints registry when execution context is clear – we will get a new set of breakpoints once the new context is initialized c) we only send InitializedRequest for DAP once main script is parsed. This triggers DAP to set breakpoints. Without this, we'd get breakpoints requests soon enough such that we wouldn't have the source map yet and hence we wouldn't be able to set them with CDP d) we update logic for determining websocket URL for expo go – now we expect two runtimes to be present with expo go with the new debugger.

How Has This Been Tested:

This has been tested on different apps on Android and iOS:

vercel[bot] commented 3 days ago

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 Nov 24, 2024 2:11pm