forked from microsoft/vscode-node-debug2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnodeScripts.ts
More file actions
28 lines (24 loc) · 1.1 KB
/
nodeScripts.ts
File metadata and controls
28 lines (24 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import { ScriptContainer } from 'vscode-chrome-debug-core';
import { NodeDebugAdapter } from './nodeDebugAdapter';
import * as path from 'path';
export class NodeScriptContainer extends ScriptContainer {
/**
* If realPath is an absolute path or a URL, return realPath. Otherwise, prepend the node_internals marker
*/
public realPathToDisplayPath(realPath: string): string {
if (!realPath.match(/VM\d+/) && !path.isAbsolute(realPath)) {
return `${NodeDebugAdapter.NODE_INTERNALS}/${realPath}`;
}
return super.realPathToDisplayPath(realPath);
}
/**
* If displayPath starts with the NODE_INTERNALS indicator, strip it.
*/
public displayPathToRealPath(displayPath: string): string {
const match = displayPath.match(new RegExp(`^${NodeDebugAdapter.NODE_INTERNALS}[\\\\/](.*)`));
return match ? match[1] : super.displayPathToRealPath(displayPath);
}
}