Add better launch config attributes, now that they can be customized
This commit is contained in:
Родитель
bdede6b864
Коммит
64ca891370
|
@ -21,7 +21,11 @@ export class PathTransformer implements IDebugTransformer {
|
|||
}
|
||||
|
||||
public launch(args: ILaunchRequestArgs): void {
|
||||
this._clientCWD = args.workingDirectory;
|
||||
this._clientCWD = args.cwd;
|
||||
}
|
||||
|
||||
public attach(args: IAttachRequestArgs): void {
|
||||
this._clientCWD = args.cwd;
|
||||
}
|
||||
|
||||
public setBreakpoints(args: ISetBreakpointsArgs): Promise<void> {
|
||||
|
|
28
package.json
28
package.json
|
@ -44,14 +44,15 @@
|
|||
"name": "Launch index.html",
|
||||
"type": "webkit",
|
||||
"request": "launch",
|
||||
"program": "index.html",
|
||||
"cwd": ".",
|
||||
"runtimeExecutable": null,
|
||||
"runtimeArgs": [
|
||||
""
|
||||
],
|
||||
"sourceMaps": false,
|
||||
"outDir": null
|
||||
"file": "index.html",
|
||||
},
|
||||
{
|
||||
"name": "Launch localhost with sourcemaps",
|
||||
"type": "webkit",
|
||||
"request": "launch",
|
||||
"file": "localhost/mypage.html",
|
||||
"sourceMaps": true,
|
||||
"outDir": "out"
|
||||
},
|
||||
{
|
||||
"name": "Attach",
|
||||
|
@ -66,6 +67,11 @@
|
|||
"description": "A local html file to open in the browser",
|
||||
"default": "index.html"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"description": "A url to open in the browser",
|
||||
"default": "mysite.com/index.html"
|
||||
},
|
||||
"cwd": {
|
||||
"type": "string",
|
||||
"description": "Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.",
|
||||
|
@ -76,7 +82,7 @@
|
|||
"string",
|
||||
"null"
|
||||
],
|
||||
"description": "Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.",
|
||||
"description": "Workspace relative or absolute path to the runtime executable to be used.",
|
||||
"default": null
|
||||
},
|
||||
"runtimeArgs": {
|
||||
|
@ -102,8 +108,8 @@
|
|||
},
|
||||
"port": {
|
||||
"type": "number",
|
||||
"description": "Port to attach to.",
|
||||
"default": "undefined"
|
||||
"description": "Port to use for Chrome remote debugging.",
|
||||
"default": 9222
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
|
|
@ -237,7 +237,7 @@ suite('WebKitDebugAdapter', () => {
|
|||
platform: () => 'win32'
|
||||
});
|
||||
const wkda = instantiateWKDA();
|
||||
return wkda.launch({ program: 'a.js', runtimeArguments: ['abc', 'def'], workingDirectory: 'c:/' }).then(() => {
|
||||
return wkda.launch({ file: 'a.js', runtimeArguments: ['abc', 'def'], cwd: 'c:/' }).then(() => {
|
||||
assert(spawnCalled);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"version": "0.1.0",
|
||||
//"debugServer": "4712",
|
||||
"debugServer": "4712",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "test chrome",
|
||||
"type": "webkit",
|
||||
"program": "out/client/index.html",
|
||||
"file": "out/client/index.html",
|
||||
"request": "launch",
|
||||
//"runtimeArgs": ["http://localhost:8080/out/client/index.html"],
|
||||
"sourceMaps": true,
|
||||
|
|
|
@ -108,7 +108,7 @@ export function promiseTimeout(p?: Promise<any>, timeoutMs: number = 1000, timeo
|
|||
|
||||
setTimeout(() => {
|
||||
if (p) {
|
||||
reject();
|
||||
reject(timeoutMsg);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
interface ILaunchRequestArgs extends DebugProtocol.LaunchRequestArguments {
|
||||
workingDirectory: string;
|
||||
cwd: string;
|
||||
runtimeArguments?: string[];
|
||||
runtimeExecutable?: string;
|
||||
program?: string;
|
||||
file?: string;
|
||||
url?: string;
|
||||
stopOnEntry?: boolean;
|
||||
sourceMaps?: boolean;
|
||||
outDir?: string;
|
||||
port?: number;
|
||||
}
|
||||
|
||||
interface IAttachRequestArgs extends DebugProtocol.AttachRequestArguments {
|
||||
cwd: string;
|
||||
port: number;
|
||||
address: string;
|
||||
sourceMaps?: boolean;
|
||||
|
|
|
@ -73,7 +73,7 @@ export class WebKitDebugAdapter implements IDebugAdapter {
|
|||
}
|
||||
|
||||
// Start with remote debugging enabled
|
||||
const port = 9222;
|
||||
const port = args.port || 9222;
|
||||
const chromeArgs: string[] = ['--remote-debugging-port=' + port];
|
||||
|
||||
// Also start with extra stuff disabled, and user-data-dir in tmp directory
|
||||
|
@ -82,13 +82,12 @@ export class WebKitDebugAdapter implements IDebugAdapter {
|
|||
chromeArgs.push(...args.runtimeArguments);
|
||||
}
|
||||
|
||||
if (args.program) {
|
||||
chromeArgs.push(args.program);
|
||||
if (args.file) {
|
||||
chromeArgs.push(path.resolve(args.cwd, args.file));
|
||||
} else if (args.url) {
|
||||
chromeArgs.push(args.url);
|
||||
} else {
|
||||
// TODO uncomment when the url field is supported
|
||||
///return Promise.reject('The launch config must specify either the "program" or "url" field.');
|
||||
return Promise.reject('The launch config must specify either the "file" or "url" field.');
|
||||
}
|
||||
|
||||
Logger.log(`spawn('${chromePath}', ${JSON.stringify(chromeArgs) })`);
|
||||
|
@ -190,7 +189,7 @@ export class WebKitDebugAdapter implements IDebugAdapter {
|
|||
this._currentStack = null;
|
||||
|
||||
// This is a private undocumented event provided by VS Code to support the 'continue' button on a paused Chrome page
|
||||
let resumedEvent = new Event('running', { threadId: WebKitDebugAdapter.THREAD_ID });
|
||||
let resumedEvent = new Event('continued', { threadId: WebKitDebugAdapter.THREAD_ID });
|
||||
this.fireEvent(resumedEvent);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче