mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Generalize the debug argument matching
This commit is contained in:
parent
918a23f2f2
commit
7452fe03a0
|
@ -164,10 +164,14 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
|
|||
private extractDebugArg(scripts: any, task: Task): [string, number] | undefined {
|
||||
let script: string = scripts[task.name];
|
||||
|
||||
let match = script.match(/--(inspect|debug)(-brk)?(=(\d*))?/);
|
||||
// matches --debug, --debug=1234, --debug-brk, debug-brk=1234, --inspect,
|
||||
// --inspect=1234, --inspect-brk, --inspect-brk=1234,
|
||||
// --inspect=localhost:1245, --inspect=127.0.0.1:1234, --inspect=[aa:1:0:0:0]:1234, --inspect=:1234
|
||||
let match = script.match(/--(inspect|debug)(-brk)?(=((\[[0-9a-fA-F:]*\]|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z0-9\.]*):)?(\d+))?/);
|
||||
|
||||
if (match) {
|
||||
if (match[4]) {
|
||||
return [match[1], parseInt(match[4])];
|
||||
if (match[6]) {
|
||||
return [match[1], parseInt(match[6])];
|
||||
}
|
||||
if (match[1] === 'inspect') {
|
||||
return [match[1], 9229];
|
||||
|
|
Loading…
Reference in a new issue