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

Debug error on multiple root folder project #102280

Closed
tzurp opened this issue Jul 12, 2020 · 8 comments
Closed

Debug error on multiple root folder project #102280

tzurp opened this issue Jul 12, 2020 · 8 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues info-needed Issue requires more information from poster

Comments

@tzurp
Copy link

tzurp commented Jul 12, 2020

ss
Issue Type: Bug

The error started after updating to v1.47.0 and disappeared when rverted back to v1.46.x.
I have a multiple root folder project that is configured to use the debug function. After upgrading to 1.47.0 I encountered the following problems:

  1. The debug is attached unwillingly when calling tsc --build for example.
  2. When clicking the debug button, an error window message appears with "${workspaceFolder) can not be resolved in a multi folder workspace. Scope this variable usin ':' and a workspace folder name" although it is scoped properly.
    Thanks

VS Code version: Code 1.47.0 (d5e9aa0, 2020-07-09T08:02:06.629Z)
OS version: Windows_NT x64 10.0.18363

@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Jul 12, 2020
@connor4312
Copy link
Member

connor4312 commented Jul 12, 2020

The debug is attached unwillingly when calling tsc --build for example.

This will be fixed in the recovery release which will add (and set a default) to only attach to node programs started with --inspect, see microsoft/vscode-js-debug@6932b62. For now you can set auto attach to "off" or "disabled" in your settings

When clicking the debug button, an error window message appears with "${workspaceFolder) can not be resolved in a multi folder workspace. Scope this variable usin ':' and a workspace folder name" although it is scoped properly.

This may be the same as #102162, see the comment there for resolution.

If that doesn't work, you can use the old debugger by setting debug.javascript.usePreview: false in your user settings for the moment, and please share your launch.json.

Thanks for filing an issue!

@connor4312 connor4312 added the info-needed Issue requires more information from poster label Jul 13, 2020
@tzurp
Copy link
Author

tzurp commented Jul 17, 2020

Attaching the launch part of the workspace file:

"launch": {
                             "configurations": [
                             {
                                           "type": "pwa-node",
                                           "request": "launch",
                                           "name": "Debug Tests",
                                           "program": "${workspaceFolder:node_modules}/@wdio/cli/bin/wdio.js",
                                           "cwd": "${workspaceFolder:...}/..",
                                           "console": "integratedTerminal",
                                           "args": [
                                                         "${workspaceFolder:configs}/wdio.per.loc.stg.ui.conf.js"
                                           ],
                                           "skipFiles": [
                                                          "${workspaceFolder:...}/out/**/*.js"
                                           ]
                             }
                             ],
                             "compounds": []
              }

@connor4312
Copy link
Member

Thank tzurp. Unfortunately I'm having a hard time getting this to reproduce on my machine with the configuration you provided.

This was my workspace configuration -- using the node "demos" folder and then another empty folder:

{
	"folders": [
		{
			"path": "C:\\Users\\Connor\\Downloads\\foo"
		},
		{
			"path": "C:\\Users\\Connor\\Documents\\Github\\vscode-js-debug\\demos\\node"
		}
	],
	"launch": {
		"configurations": [
			{
				"type": "pwa-node",
				"request": "launch",
				"name": "Debug Tests",
				"program": "${workspaceFolder:node}/main.js",
				"cwd": "${workspaceFolder:node}/..",
				"console": "integratedTerminal",
				"args": [
					"${workspaceFolder:node}/wdio.per.loc.stg.ui.conf.js"
				],
				"skipFiles": [
					"${workspaceFolder:node}/out/**/*.js"
				]
			}
		],
		"compounds": []
	},
	"settings": {}
}

This worked running on VS Code 1.47.2.

Please make sure you're up to date with js-debug (the latest is version 1.47.5). If you previously installed the nightly, make sure that's up to date as well (the latest is 2020.7.1611). If you're still having trouble it'd be very helpful if you can create a small example/repo where this problem occurs.

@lSoleyl
Copy link

lSoleyl commented Jul 21, 2020

Also having this issue and cannot launch my existing debug configurations anymore.
I created a simple test setup to reproduce this issue and it looks as follows:

C:\Users\xx\Desktop\test

  • workspace.code-workspace
  • main
    • index.js
  • utils

I inserted the full workspace definition below. As you can see there is no reference to ${workspaceFolder} anymore, I just inserted the full path. I also tried the following paths always with the same error message:

  • ${file} (as was autogenerated by launch config generator)
  • ${workspaceFolder:main}\\index.js

When just opening the main folder with VSCode (as single folder workspace) and generating a debug configuration, everything works fine.

test\workspace.code-workspace:

{
	"folders": [
		{
			"path": "main"
		},
		{
			"path": "utils"
		}		
	],
	"settings": {},
	"launch": {
		"version": "0.2.0",
		"configurations": [
			{
				"type": "node",
				"request": "launch",
				"name": "Launch Program",
				"skipFiles": [
					"<node_internals>/**"
				],
				"program": "C:\\Users\\xx\\Desktop\\test\\main\\index.js"
			}
		]
	}
}

Hope this additional info helps with reproducing the issue.
I also disabled all extensions except for ms-vscode.js-debug (installed version is 1.47.5) for this workspace.

VSCode version dump:

Version: 1.47.2 (system setup)
Commit: 17299e413d5590b14ab0340ea477cdd86ff13daf
Date: 2020-07-15T18:22:06.216Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363

@connor4312
Copy link
Member

@lSoleyl try setting your type to pwa-node

@lSoleyl
Copy link

lSoleyl commented Jul 21, 2020

Thanks. I don't quite understand why this fixed it, but it now works. Is "type":"node" deprecated or does it simply not support multi folder workspaces anymore?

@connor4312
Copy link
Member

type: node has its config resolved using the old debuggers and then redirects the debug request to the new debugger. With type: pwa-node, the config is resolved by the new debugger directly, which is able to fill out the options that the old debugger doesn't know about.

@github-actions
Copy link

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@github-actions github-actions bot locked and limited conversation to collaborators Sep 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

5 participants