Skip to content

Commit

Permalink
adapt launch and debug to remote environment
Browse files Browse the repository at this point in the history
  • Loading branch information
ElormCoch committed Oct 24, 2023
1 parent 1af6026 commit b8637f8
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,20 +239,37 @@ export function activate(context: vscode.ExtensionContext): void {
void setCSSMirrorContentEnabled(context, !cssMirrorContent);
}));

context.subscriptions.push(vscode.commands.registerCommand(`${SETTINGS_VIEW_NAME}.launchHtml`, (fileUri: vscode.Uri): void => {
context.subscriptions.push(vscode.commands.registerCommand(`${SETTINGS_VIEW_NAME}.launchHtml`, async (fileUri: vscode.Uri): Promise<void> => {
telemetryReporter.sendTelemetryEvent('contextMenu/launchHtml');
const edgeDebugConfig = providedHeadlessDebugConfig;
const devToolsAttachConfig = providedLaunchDevToolsConfig;
edgeDebugConfig.url = `file://${fileUri.fsPath}`;
devToolsAttachConfig.url = `file://${fileUri.fsPath}`;
void vscode.debug.startDebugging(undefined, edgeDebugConfig).then(() => vscode.debug.startDebugging(undefined, devToolsAttachConfig));
const { defaultUrl } = getRemoteEndpointSettings();
if (typeof vscode.env.remoteName === 'undefined') {
edgeDebugConfig.url = `file://${fileUri.fsPath}`;
devToolsAttachConfig.url = `file://${fileUri.fsPath}`;
void vscode.debug.startDebugging(undefined, edgeDebugConfig).then(() => vscode.debug.startDebugging(undefined, devToolsAttachConfig));
} else {
edgeDebugConfig.url = defaultUrl;
devToolsAttachConfig.url = defaultUrl;
const { port, userDataDir } = getRemoteEndpointSettings();
const browserPath = await getBrowserPath();
await launchBrowser(browserPath, port, defaultUrl, userDataDir).then(() => vscode.debug.startDebugging(undefined, devToolsAttachConfig));
}
}));

context.subscriptions.push(vscode.commands.registerCommand(`${SETTINGS_VIEW_NAME}.launchScreencast`, (fileUri: vscode.Uri): void => {
context.subscriptions.push(vscode.commands.registerCommand(`${SETTINGS_VIEW_NAME}.launchScreencast`, async(fileUri: vscode.Uri): Promise<void> => {

Check failure on line 260 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Missing space before function parentheses

Check failure on line 260 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Missing space before function parentheses

Check failure on line 260 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Missing space before function parentheses

Check failure on line 260 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Missing space before function parentheses
telemetryReporter.sendTelemetryEvent('contextMenu/launchScreencast');
const edgeDebugConfig = providedHeadlessDebugConfig;
edgeDebugConfig.url = `file://${fileUri.fsPath}`;
void vscode.debug.startDebugging(undefined, edgeDebugConfig).then(() => attach(context, fileUri.fsPath, undefined, true, true));
const { defaultUrl } = getRemoteEndpointSettings();
if (typeof vscode.env.remoteName === 'undefined') {
edgeDebugConfig.url = `file://${fileUri.fsPath}`;
void vscode.debug.startDebugging(undefined, edgeDebugConfig).then(() => attach(context, fileUri.fsPath, undefined, true, true));
} else {
edgeDebugConfig.url = defaultUrl;
const { port, userDataDir } = getRemoteEndpointSettings();
const browserPath = await getBrowserPath();
await launchBrowser(browserPath, port, defaultUrl, userDataDir).then(() => attach(context, defaultUrl, undefined, true, true));
}
}));

void vscode.commands.executeCommand('setContext', 'titleCommandsRegistered', true);
Expand Down

0 comments on commit b8637f8

Please sign in to comment.