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

Debugging doesn't launch/attach when app is not in workspace root #149

Closed tomborysiak closed 7 years ago

tomborysiak commented 7 years ago

I have my nativescript app in a subfolder (game-client) one level down from my workspace (/home/dev/source/wordgame). When I try to launch or attach the debugger using:

"appRoot": "${workspaceRoot}/game-client"

nothing happens. Turning on diagnostic logging gives me:

Console:

initialize({"clientID":"vscode","adapterID":"nativescript","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-gb"}) attach({"name":"Android App","type":"nativescript","request":"attach","platform":"android","appRoot":"/home/dev/source/wordgame/game-client","sourceMaps":true,"watch":false,"diagnosticLogging":true,"__sessionId":"8d7f5f81-e6b3-4a65-b188-fd05717ebee8"})

And it just hangs there forever.

If I remove the /game-client from appRoot, the debugger tries to run but can't find the app.

Console:

initialize({"clientID":"vscode","adapterID":"nativescript","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-gb"}) attach({"name":"Android App","type":"nativescript","request":"attach","platform":"android","appRoot":"/home/dev/source/wordgame","sourceMaps":true,"watch":false,"diagnosticLogging":true,"__sessionId":"aa614a26-048a-411b-9e52-0a7d63470658"}) [NativeScriptCli] execute: tns --analyticsClient VSCode --version [NSDebugAdapter] Using tns CLI v3.2.1 on path 'tns' [NSDebugAdapter] Running tns command... [NativeScriptCli] execute: tns --analyticsClient VSCode debug android --no-client --start [NSDebugAdapter] Watching the tns CLI output to receive a connection token [31;1mNo project found at or above '/home/dev/source/wordgame' and neither was a --path specified.

I've tried passing in the --path via "tnsArgs" and the debugger will launch and attach but no breakpoints will be hit because it cannot find any of the files since the appRoot is still incorrect.

Console:

initialize({"clientID":"vscode","adapterID":"nativescript","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-gb"}) attach({"name":"Android App","type":"nativescript","request":"attach","platform":"android","appRoot":"/home/dev/source/wordgame","sourceMaps":true,"watch":false,"diagnosticLogging":true,"tnsArgs":["--path=./game-client"],"__sessionId":"bf66e185-83c7-4aca-a9ff-ae7e71915a60"}) [NativeScriptCli] execute: tns --analyticsClient VSCode --version [NSDebugAdapter] Using tns CLI v3.2.1 on path 'tns' [NSDebugAdapter] Running tns command... [NativeScriptCli] execute: tns --analyticsClient VSCode debug android --no-client --start --path=./game-client [NSDebugAdapter] Watching the tns CLI output to receive a connection token Searching for devices... device: emulator-5554 debug port: 40000 To start debugging, open the following URL in Chrome: chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:40000 [NSDebugAdapter] The tns command finished its execution with code 0. [NSDebugAdapter] Ready to attach to application on 40000

tomborysiak commented 7 years ago

Duplicate of #104