nativescript-community / nativescript-vscode-extension

A Visual Studio Code Extension for NativeScript
https://www.nativescript.org/visual-studio-code
Apache License 2.0
82 stars 32 forks source link

feat: add support for debug with hmr #244

Closed rosen-vladimirov closed 5 years ago

rosen-vladimirov commented 5 years ago

Add support for Debug + HMR - currently it is not working, as when a hot-module is applied, VSCode does not know that the current hot-module is mapped to the actual changed file (main-view-model) for example. To fix this, add SourceMapTransformer and plug in the scriptParsed method. When breakpoint is set, cache it (in nativeScriptDebugAdapter), so once hot-module is applied, set the breakpoints from its original file (i.e. main-view-model) in the newly applied hot module. This is exactly how Chrome works.

Also, add logic in pathTransformer to map files from platforms dir when debugging on iOS.

Related to: https://github.com/NativeScript/nativescript-vscode-extension/issues/221