mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
parent
7701642b26
commit
916de64d89
|
@ -137,7 +137,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
|
|||
}
|
||||
|
||||
private async debugScript(script: NpmScript) {
|
||||
startDebugging(script.task.name, script.getFolder());
|
||||
startDebugging(script.task.definition.script, path.dirname(script.package.resourceUri!.fsPath), script.getFolder());
|
||||
}
|
||||
|
||||
private findScript(document: TextDocument, script?: NpmScript): number {
|
||||
|
|
|
@ -11,6 +11,7 @@ import {
|
|||
createTask, startDebugging, findAllScriptRanges
|
||||
} from './tasks';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { dirname } from 'path';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
|
@ -107,12 +108,12 @@ export class NpmScriptHoverProvider implements HoverProvider {
|
|||
}
|
||||
}
|
||||
|
||||
public debugScriptFromHover(args: any) {
|
||||
public debugScriptFromHover(args: { script: string; documentUri: Uri }) {
|
||||
let script = args.script;
|
||||
let documentUri = args.documentUri;
|
||||
let folder = workspace.getWorkspaceFolder(documentUri);
|
||||
if (folder) {
|
||||
startDebugging(script, folder);
|
||||
startDebugging(script, dirname(documentUri.fsPath), folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -357,11 +357,12 @@ export function runScript(script: string, document: TextDocument) {
|
|||
}
|
||||
}
|
||||
|
||||
export function startDebugging(scriptName: string, folder: WorkspaceFolder) {
|
||||
export function startDebugging(scriptName: string, cwd: string, folder: WorkspaceFolder) {
|
||||
const config: DebugConfiguration = {
|
||||
type: 'pwa-node',
|
||||
request: 'launch',
|
||||
name: `Debug ${scriptName}`,
|
||||
cwd,
|
||||
runtimeExecutable: getPackageManager(folder),
|
||||
runtimeArgs: [
|
||||
'run',
|
||||
|
|
Loading…
Reference in a new issue