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

Extension fails to attach when updating from ns-cli 7.1 to 7.2 #283

Open fraune opened 3 years ago

fraune commented 3 years ago

Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

Describe the bug VS Code giving the following error when trying to attach debugger: NativeScript CLI not found. Use 'nativescript.tnsPath' workspace setting to explicitly set the absolute path to the NativeScript CLI.. This doesn't seem to be a problem when I downgrade the CLI to 7.1.2, but the problem exists for me on CLI 7.2.*.

To Reproduce

  1. Update NativeScript CLI to latest (7.2.1) via npm i -g nativescript.
  2. Launch app via ns run --no-hmr
  3. While in the working folder in VS Code, attach on iOS

Expected behavior Debugger should attach and set breakpoints should be hit.

Sample project Not sharing at this time...

Additional context I am working in a NativeScript 6 project with ns-cli 7, due to dependency package support problems. Never had trouble with the debugger until an update to ns-cli 7.2+.

NathanWalker commented 3 years ago

@fraune out of curiosity, in VS Code plugin pane, can you choose the option next to the {N} plugin to install a specific version and choose 0.11.0 - I'd be curious if that prior version works for you in this case?

fraune commented 3 years ago

Tried installing another version (0.11.0) and got the following message:

[2021-03-15 13:32:55.900] [renderer1] [error] Error: Unable to install extension 'nativescript.nativescript' as it is not compatible with VS Code '0.11.0'.
    at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1692:15746
    at async file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2431:94753
    at async T.run (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:171:30414)
    at async a.runAction (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1233:31224)

I downloaded and installed the VSIX manually, and see the same error as before (NativeScript CLI not found. Use 'nativescript.tnsPath' workspace setting to explicitly set the absolute path to the NativeScript CLI.)

NathanWalker commented 3 years ago

Ok good to know, thanks for confirming.

fraune commented 3 years ago

In case it helps, here's a little more information about my system:

Let me know if there's any other information I can give to help replicate this behavior.

NathanWalker commented 3 years ago

@fraune 0.12.3 has been published now, once updated please give it a try and lemme know.

fraune commented 3 years ago

Working now! Much appreciated.

fraune commented 3 years ago

This should probably be another issue, but after updating to macOS 11.2.3, my breakpoints haven't been gettin hit in VS Code and hovering over them gives me the following message:

Breakpoint ignored because generated code not found (source map problem?).

Have you had any trouble with attaching breakpoints in vscode or seen any other issues for this?

dmedina2015 commented 3 years ago

Hi, I'm getting similar problem trying to debug a NS project with VSCode and nativescript-vscode-extension.

Environment: MacOS: 11.2.2 (BigSur) VSCode: 1.54.3 NS CLI: 7.2.1 nativescript-vscode-extension: 0.12.3

How to reproduce: (1) Create a brand new project using ns create foo (2) Create launch.json using instructions in this link (3) Plug phone (dev mode + usb debugging enabled) to the computer. (4) Run configuration "Launch on Android"

Expected Behaviour App opens on phone and breakpoints are triggered in VSCode.

Observed Behaviour

Installing on device 27236b14b71c7ece...

Successfully installed on device with identifier '27236b14b71c7ece'.

Restarting application on device 27236b14b71c7ece...

NativeScript Debugger started

device: 27236b14b71c7ece debug port: 40000

To start debugging, open the following URL in Chrome: devtools://devtools/bundled/inspector.html?ws=localhost:40000

Successfully synced application org.nativescript.nativeFront on device 27236b14b71c7ece.

[NSDebugAdapter] Ready to attach to application on 40000

fraune commented 3 years ago

@NathanWalker The original issue I experienced was addressed with the 0.12.3 update. I opened a new issue for the breakpoint trouble I mentioned. Not sure what @dmedina2015 is experiencing, but I think the issue I opened could be marked as solved.