Skip to content
This repository was archived by the owner on Sep 17, 2021. It is now read-only.

Commit 88b28c0

Browse files
committed
addressing comments
1 parent dc141bd commit 88b28c0

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

src/extension.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ export function activate(context: vscode.ExtensionContext) {
4747

4848
resolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration, token?: vscode.CancellationToken): vscode.ProviderResult<vscode.DebugConfiguration> {
4949
if (config && config.type == debuggerType) {
50-
let targetUri: string = utils.getUrlFromConfig(folder, config);
50+
const targetUri: string = utils.getUrlFromConfig(folder, config);
5151
if (config.request && config.request.localeCompare('attach', 'en', { sensitivity: 'base' }) == 0) {
5252
attach(context, /* viaConfig= */ true, targetUri);
53-
telemetryReporter.sendTelemetryEvent('launch/command/launch');
53+
telemetryReporter.sendTelemetryEvent('launch/command/attach');
5454
} else if (config.request && config.request.localeCompare('launch', 'en', { sensitivity: 'base' }) == 0) {
5555
launch(context, targetUri, config.chromePath);
56-
telemetryReporter.sendTelemetryEvent('launch/command/attach');
56+
telemetryReporter.sendTelemetryEvent('launch/command/launch');
5757
}
5858
} else {
5959
vscode.window.showErrorMessage('No supported launch config was found.');
@@ -108,26 +108,24 @@ async function attach(context: vscode.ExtensionContext, viaConfig: boolean, targ
108108

109109
responseArray.forEach(i => {
110110
i = utils.fixRemoteUrl(hostname, port, i);
111-
items.push({
112-
label: i.title,
113-
description: i.url,
114-
detail: i.webSocketDebuggerUrl
111+
items.push({
112+
label: i.title,
113+
description: i.url,
114+
detail: i.webSocketDebuggerUrl
115115
});
116116
});
117117

118-
let targetMatch:boolean = false;
119-
let targetWebsocketUrl:string = '';
118+
let targetWebsocketUrl = '';
120119
if (typeof targetUrl === 'string' && targetUrl.length > 0 && targetUrl != defaultUrl) {
121120
const matches = items.filter(i => targetUrl.localeCompare(i.description, 'en', { sensitivity: 'base' }) == 0);
122-
if(matches && matches.length > 0 ){
121+
if (matches && matches.length > 0 ) {
123122
targetWebsocketUrl = matches[0].detail;
124-
targetMatch = true;
125123
} else {
126124
vscode.window.showErrorMessage(`Couldn't attach to ${targetUrl}.`);
127125
}
128-
}
126+
}
129127

130-
if(targetMatch){
128+
if (targetWebsocketUrl && targetWebsocketUrl.length > 0) {
131129
DevToolsPanel.createOrShow(context, targetWebsocketUrl as string);
132130
} else {
133131
vscode.window.showQuickPick(items).then((selection) => {

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ export function forceForwardSlashes(aUrl: string): string {
144144
}
145145

146146
export function getUrlFromConfig(folder: vscode.WorkspaceFolder, config: vscode.DebugConfiguration): string {
147-
let outUrlString:string = '';
147+
let outUrlString = '';
148148

149149
if (config.file) {
150150
outUrlString = config.file;
151151
outUrlString = outUrlString.replace('${workspaceFolder}', folder.uri.path);
152152
outUrlString = pathToFileURL(outUrlString);
153-
} else if(config.url){
153+
} else if (config.url ) {
154154
outUrlString = config.url;
155155
}
156156

0 commit comments

Comments
 (0)