MCPcopy Index your code
hub / github.com/microsoft/vscode-js-debug / analyseArguments

Function analyseArguments

src/ui/processTree/processTree.ts:114–136  ·  view source on GitHub ↗
(args: string)

Source from the content-addressed store, hash-verified

112 * Analyse the given command line arguments and extract debug port and protocol from it.
113 */
114export function analyseArguments(args: string) {
115 const DEBUG_PORT_PATTERN = /--inspect-port=(\d+)/;
116
117 let address: string | undefined;
118 let port: number | undefined;
119
120 // match --inspect, --inspect=1234, --inspect-brk, --inspect-brk=1234
121 let matches = DEBUG_FLAGS_PATTERN().exec(args);
122 if (matches?.groups) {
123 const portStr = matches.groups.port1 || matches.groups.port2;
124 port = portStr ? Number(portStr) : 9229;
125 address = matches.groups.address ?? '127.0.0.1';
126 }
127
128 // a --inspect-port=1234 overrides the port
129 matches = DEBUG_PORT_PATTERN.exec(args);
130 if (matches && matches.length === 2) {
131 address ||= '127.0.0.1';
132 port = parseInt(matches[1]);
133 }
134
135 return { address, port };
136}

Callers 3

watchAllChildrenFunction · 0.90
listProcessesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected