Skip to content

Commit 1e5e1da

Browse files
authored
open help center to side on walkthrough (#723)
* open help center to side on walkthrough Signed-off-by: Yan Zhang <yanzh@microsoft.com> * remove comments Signed-off-by: Yan Zhang <yanzh@microsoft.com>
1 parent fba856a commit 1e5e1da

3 files changed

Lines changed: 27 additions & 5 deletions

File tree

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
{
165165
"id": "java.showHelpCenter",
166166
"title": "Java Help Center",
167-
"description": "Discover more shortcuts and features on this page.\n[Open Java Help Center](command:java.welcome)",
167+
"description": "Discover more shortcuts and features on this page.\n[Open Java Help Center](command:toSide:java.welcome.fromWalkthrough)",
168168
"media": {
169169
"image": "walkthrough/help-center.png",
170170
"altText": "Java Help Center"
@@ -179,6 +179,11 @@
179179
"category": "Java",
180180
"title": "Help Center (Welcome)"
181181
},
182+
{
183+
"command": "java.welcome.fromWalkthrough",
184+
"category": "Java",
185+
"title": "Help Center (Welcome)"
186+
},
182187
{
183188
"command": "java.classpathConfiguration",
184189
"category": "Java",
@@ -259,6 +264,10 @@
259264
{
260265
"command": "java.formatterSettings.showTextEditor",
261266
"when": "false"
267+
},
268+
{
269+
"command": "java.welcome.fromWalkthrough",
270+
"when": "false"
262271
}
263272
],
264273
"view/title": [

src/commands/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { javaRuntimeCmdHandler } from "../java-runtime";
99
import { javaGettingStartedCmdHandler } from "../getting-started";
1010
import { javaExtGuideCmdHandler } from "../ext-guide";
1111
import { instrumentOperationAsVsCodeCommand } from "vscode-extension-telemetry-wrapper";
12-
import { showWelcomeWebview } from "../welcome";
12+
import { showWelcomeWebview, showWelcomeWebviewBeside } from "../welcome";
1313
import { showClasspathConfigurationPage } from "../classpath/classpathConfigurationView";
1414
import { javaFormatterSettingsEditorProvider } from "../formatter-settings";
1515

@@ -27,7 +27,8 @@ export function initialize(context: vscode.ExtensionContext) {
2727
context.subscriptions.push(vscode.commands.registerCommand("java.gettingStarted", instrumentCommand(context, "java.gettingStarted", javaGettingStartedCmdHandler)));
2828
context.subscriptions.push(vscode.commands.registerCommand("java.extGuide", instrumentCommand(context, "java.extGuide", javaExtGuideCmdHandler)));
2929
context.subscriptions.push(instrumentOperationAsVsCodeCommand("java.webview.runCommand", webviewCmdLinkHandler));
30-
context.subscriptions.push(vscode.commands.registerCommand("java.welcome", instrumentCommand(context, "java.welcome", showWelcomeWebview)));
30+
context.subscriptions.push(vscode.commands.registerCommand("java.welcome", instrumentCommand(context, "java.welcome", showWelcomeWebviewBeside)));
31+
context.subscriptions.push(vscode.commands.registerCommand("java.welcome.fromWalkthrough", instrumentCommand(context, "java.welcome.fromWalkthrough", showWelcomeWebview)));
3132
context.subscriptions.push(vscode.commands.registerCommand("java.formatterSettings", instrumentCommand(context, "java.formatterSettings", () => javaFormatterSettingsEditorProvider.showFormatterSettingsEditor())));
3233
context.subscriptions.push(vscode.commands.registerCommand("java.formatterSettings.showTextEditor", instrumentCommand(context, "java.formatterSettings.showTextEditor", javaFormatterSettingsEditorProvider.reopenWithTextEditor)));
3334
context.subscriptions.push(vscode.commands.registerCommand("java.classpathConfiguration", instrumentCommand(context, "java.classpathConfiguration", showClasspathConfigurationPage)));

src/welcome/index.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ import { isWalkthroughEnabled } from "../utils/walkthrough";
1010

1111
let welcomeView: vscode.WebviewPanel | undefined;
1212

13-
export async function showWelcomeWebview(context: vscode.ExtensionContext, _operationId?: string, options?: any) {
13+
// from command palette
14+
export async function showWelcomeWebviewBeside(context: vscode.ExtensionContext, _operationId?: string, options?: {
15+
firstTimeRun?: boolean;
16+
}) {
17+
const newOptions = { openBeside: true, firstTimeRun: options?.firstTimeRun };
18+
await showWelcomeWebview(context, _operationId, newOptions);
19+
}
20+
21+
export async function showWelcomeWebview(context: vscode.ExtensionContext, _operationId?: string, options?: {
22+
firstTimeRun?: boolean;
23+
openBeside?: boolean;
24+
}) {
1425
if (options?.firstTimeRun) {
1526
setFirstTimeRun(context, true);
1627
}
@@ -19,10 +30,11 @@ export async function showWelcomeWebview(context: vscode.ExtensionContext, _oper
1930
welcomeView.reveal();
2031
fetchInitProps(context);
2132
} else {
33+
const viewColumn = options?.openBeside ? vscode.ViewColumn.Beside : vscode.ViewColumn.Active;
2234
welcomeView = vscode.window.createWebviewPanel(
2335
"java.welcome",
2436
"Java Help Center",
25-
vscode.ViewColumn.Beside,
37+
viewColumn,
2638
{
2739
enableScripts: true,
2840
enableCommandUris: true,

0 commit comments

Comments
 (0)