Skip to content

Commit

Permalink
Adding dukRemoteRoot option so a source prefix can be specified if th…
Browse files Browse the repository at this point in the history
…e remote environment doesn't match the local one
  • Loading branch information
andrewrch committed Nov 10, 2019
1 parent 72907d8 commit 310fa6d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "duk-debug",
"displayName": "Duktape Debugger",
"version": "0.5.2",
"version": "0.5.3",
"description": "Debug Adapter for Duktape runtimes.",
"author": "Harold Brenes",
"publisher": "HaroldBrenes",
Expand Down Expand Up @@ -155,6 +155,11 @@
"description": "The local source root paths that correspond to the remote root paths.",
"default": null
},
"dukRemoteRoot": {
"type": "string",
"description": "Optional prefix for filenames in the remote environment.",
"default": null
},
"debugLog": {
"type": "boolean",
"description": "Log to console client-server network traffic and other debug messages. This is an internal development feature but allowed in release mode for the curious.",
Expand Down
14 changes: 13 additions & 1 deletion src/DukDebugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ export interface AttachRequestArguments extends DebugProtocol.AttachRequestArgum
localRoot?: string;
/** VS Code's root directories. */
localRoots?: string[];

/** Duktape root directory */
dukRemoteRoot?: string;
}

// Utitity
Expand Down Expand Up @@ -391,6 +394,7 @@ export class DukDebugSession extends DebugSession {
private _targetProgram: string;
private _sourceRoots: string[];
private _outDir: string;
private _remoteRoot: string;
private _stopOnEntry: boolean;
private _dukProto: DukDbgProtocol;

Expand Down Expand Up @@ -657,6 +661,10 @@ export class DukDebugSession extends DebugSession {
);
}

if (args.dukRemoteRoot) {
this._remoteRoot = args.dukRemoteRoot;
}

this._outDir = this.normPath(args.outDir);
this._dbgLog = args.debugLog || false;

Expand Down Expand Up @@ -1988,7 +1996,11 @@ export class DukDebugSession extends DebugSession {

let src: SourceFile = new SourceFile();
src.id = this._nextSourceID++;
src.name = name;
if (this._remoteRoot) {
src.name = Path.join(this._remoteRoot, name);
} else {
src.name = name;
}
src.path = fpath;

sources[src.id] = src;
Expand Down

0 comments on commit 310fa6d

Please sign in to comment.