Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
added 'restart' support for 'launch'; fixes microsoft/vscode#15804 and
Browse files Browse the repository at this point in the history
  • Loading branch information
weinand committed Dec 21, 2016
1 parent cb1fc52 commit 0824977
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
24 changes: 15 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@
"outFiles": [ "${workspaceRoot}/out/**/*.js" ],
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "node",
"request": "launch",
"name": "Server (nodemon)",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script", "nodemon"
],
"restart": true,
"port": 5858,
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/**/*.js" ],
"console": "integratedTerminal"
},
{
"type": "node",
"request": "launch",
Expand All @@ -38,15 +53,6 @@
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/**/*.js" ],
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "node",
"request": "attach",
"name": "Nodemon Attach",
"restart": true,
"port": 5858,
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/**/*.js" ]
}
],
"compounds": [
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@
"description": "%node.timeout.description%",
"default": 10000
},
"restart": {
"type": "boolean",
"description": "%node.restart.description%",
"default": true
},
"smartStep": {
"type": "boolean",
"description": "%smartStep.description%",
Expand Down Expand Up @@ -239,7 +244,7 @@
},
"restart": {
"type": "boolean",
"description": "%node.attach.restart.description%",
"description": "%node.restart.description%",
"default": true
},
"sourceMaps": {
Expand Down
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"node.port.description": "Debug port to attach to. Default is 5858.",
"node.address.description": "TCP/IP address of debug port (for Node.js >= 5.0 only). Default is 'localhost'.",
"node.timeout.description": "Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.",
"node.restart.description": "Restart session after Node.js has terminated.",

"node.launch.program.description": "Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.",
"node.launch.externalConsole.deprecationMessage": "Attribute 'externalConsole' is deprecated, use 'console' instead.",
Expand All @@ -28,7 +29,6 @@
"node.launch.config.name": "Launch",

"node.attach.processId.description": "Id of process to attach to.",
"node.attach.restart.description": "Restart session after Node.js has terminated.",
"node.attach.localRoot.description": "The local source root that corresponds to the 'remoteRoot'.",
"node.attach.remoteRoot.description": "The source root of the remote host.",

Expand Down
12 changes: 6 additions & 6 deletions src/node/nodeDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ interface CommonArguments {
smartStep?: boolean;
/** automatically skip these files. */
skipFiles?: string[];
/** Request frontend to restart session on termination. */
restart?: boolean;

// unofficial flags

Expand Down Expand Up @@ -282,8 +284,6 @@ interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments, C
* This interface should always match the schema found in the node-debug extension manifest.
*/
interface AttachRequestArguments extends DebugProtocol.AttachRequestArguments, CommonArguments {
/** Request frontend to restart session on termination. */
restart?: boolean;
/** Node's root directory. */
remoteRoot?: string;
/** VS Code's root directory. */
Expand Down Expand Up @@ -1019,6 +1019,10 @@ export class NodeDebugSession extends DebugSession {
this._stopOnEntry = args.stopOnEntry;
}

if (typeof args.restart === 'boolean') {
this._restartMode = args.restart;
}

if (!this._sourceMaps) {
if (typeof args.sourceMaps === 'boolean' && args.sourceMaps) {
const generatedCodeDirectory = args.outDir;
Expand Down Expand Up @@ -1054,10 +1058,6 @@ export class NodeDebugSession extends DebugSession {
this._attachMode = true;
}

if (typeof args.restart === 'boolean') {
this._restartMode = args.restart;
}

if (args.localRoot) {
const localRoot = args.localRoot;
if (!Path.isAbsolute(localRoot)) {
Expand Down

0 comments on commit 0824977

Please sign in to comment.