Skip to content

Commit d84c946

Browse files
authored
Support command:toSide in markdown also (microsoft#205316)
1 parent 03aeb95 commit d84c946

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,12 @@ export class GettingStartedPage extends EditorPane {
645645

646646
this.stepDisposables.add(this.webview.onDidClickLink(link => {
647647
if (matchesScheme(link, Schemas.https) || matchesScheme(link, Schemas.http) || (matchesScheme(link, Schemas.command))) {
648-
this.openerService.open(link, { allowCommands: true });
648+
const toSide = link.startsWith('command:toSide:');
649+
if (toSide) {
650+
link = link.replace('command:toSide:', 'command:');
651+
this.focusSideEditorGroup();
652+
}
653+
this.openerService.open(link, { allowCommands: true, openToSide: toSide });
649654
}
650655
}));
651656

@@ -1164,6 +1169,25 @@ export class GettingStartedPage extends EditorPane {
11641169
return widget;
11651170
}
11661171

1172+
private focusSideEditorGroup() {
1173+
const fullSize = this.group ? this.groupsService.getPart(this.group).contentDimension : undefined;
1174+
if (!fullSize || fullSize.width <= 700) { return; }
1175+
if (this.groupsService.count === 1) {
1176+
const sideGroup = this.groupsService.addGroup(this.groupsService.groups[0], GroupDirection.RIGHT);
1177+
this.groupsService.activateGroup(sideGroup);
1178+
1179+
const gettingStartedSize = Math.floor(fullSize.width / 2);
1180+
1181+
const gettingStartedGroup = this.groupsService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE).find(group => (group.activeEditor instanceof GettingStartedInput));
1182+
this.groupsService.setSize(assertIsDefined(gettingStartedGroup), { width: gettingStartedSize, height: fullSize.height });
1183+
}
1184+
1185+
const nonGettingStartedGroup = this.groupsService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE).find(group => !(group.activeEditor instanceof GettingStartedInput));
1186+
if (nonGettingStartedGroup) {
1187+
this.groupsService.activateGroup(nonGettingStartedGroup);
1188+
nonGettingStartedGroup.focus();
1189+
}
1190+
}
11671191
private runStepCommand(href: string) {
11681192

11691193
const isCommand = href.startsWith('command:');
@@ -1172,24 +1196,8 @@ export class GettingStartedPage extends EditorPane {
11721196

11731197
this.telemetryService.publicLog2<GettingStartedActionEvent, GettingStartedActionClassification>('gettingStarted.ActionExecuted', { command: 'runStepAction', argument: href, walkthroughId: this.currentWalkthrough?.id });
11741198

1175-
const fullSize = this.group ? this.groupsService.getPart(this.group).contentDimension : undefined;
1176-
1177-
if (toSide && fullSize && fullSize.width > 700) {
1178-
if (this.groupsService.count === 1) {
1179-
const sideGroup = this.groupsService.addGroup(this.groupsService.groups[0], GroupDirection.RIGHT);
1180-
this.groupsService.activateGroup(sideGroup);
1181-
1182-
const gettingStartedSize = Math.floor(fullSize.width / 2);
1183-
1184-
const gettingStartedGroup = this.groupsService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE).find(group => (group.activeEditor instanceof GettingStartedInput));
1185-
this.groupsService.setSize(assertIsDefined(gettingStartedGroup), { width: gettingStartedSize, height: fullSize.height });
1186-
}
1187-
1188-
const nonGettingStartedGroup = this.groupsService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE).find(group => !(group.activeEditor instanceof GettingStartedInput));
1189-
if (nonGettingStartedGroup) {
1190-
this.groupsService.activateGroup(nonGettingStartedGroup);
1191-
nonGettingStartedGroup.focus();
1192-
}
1199+
if (toSide) {
1200+
this.focusSideEditorGroup();
11931201
}
11941202
if (isCommand) {
11951203
const commandURI = URI.parse(command);

0 commit comments

Comments
 (0)