Skip to content

Commit 0a0bba1

Browse files
authored
Settings to reduce popups (#473)
1 parent df1ee46 commit 0a0bba1

File tree

3 files changed

+40
-17
lines changed

3 files changed

+40
-17
lines changed

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,24 @@
7878
"enum": [
7979
"auto",
8080
"overview",
81-
"gettingStarted"
81+
"gettingStarted",
82+
"none"
8283
],
8384
"enumDescriptions": [
8485
"Automatically pick the first experience view",
8586
"Present the Java Overview page",
86-
"Present the Java Getting Started page"
87+
"Present the Java Getting Started page",
88+
"Do not show any view"
8789
],
8890
"default": "auto",
8991
"description": "Sets the default view which is presented during the first use.",
9092
"scope": "window"
93+
},
94+
"java.help.showReleaseNotes": {
95+
"type": "boolean",
96+
"default": true,
97+
"description": "Show Java Extension Pack release notes on startup.",
98+
"scope": "window"
9199
}
92100
}
93101
}

src/extension.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,19 @@ async function initializeExtension(_operationId: string, context: vscode.Extensi
3131
// context.subscriptions.push(vscode.window.registerWebviewPanelSerializer("java.runtime", new JavaRuntimeViewSerializer()));
3232
// context.subscriptions.push(vscode.window.registerWebviewPanelSerializer("java.gettingStarted", new JavaGettingStartedViewSerializer()));
3333

34-
scheduleAction("showFirstView", true).then(() => {
35-
presentFirstView(context);
36-
});
34+
const config = vscode.workspace.getConfiguration("java.help");
35+
36+
if (config.get("firstView") !== HelpViewType.None) {
37+
scheduleAction("showFirstView", true).then(() => {
38+
presentFirstView(context);
39+
});
40+
}
3741

38-
scheduleAction("showReleaseNotes").then(() => {
39-
showReleaseNotesOnStart(context);
40-
});
42+
if (config.get("showReleaseNotes")) {
43+
scheduleAction("showReleaseNotes").then(() => {
44+
showReleaseNotesOnStart(context);
45+
});
46+
}
4147

4248
if (!await validateJavaRuntime()) {
4349
scheduleAction("showJdkState", true, true).then(() => {
@@ -55,11 +61,15 @@ async function presentFirstView(context: vscode.ExtensionContext) {
5561

5662
const config = vscode.workspace.getConfiguration("java.help");
5763
const firstView = config.get("firstView");
58-
if (firstView === HelpViewType.GettingStarted) {
59-
await showGettingStartedView(context);
60-
} else {
61-
await showOverviewPageOnActivation(context);
62-
}
64+
switch (firstView) {
65+
case HelpViewType.None:
66+
break;
67+
case HelpViewType.GettingStarted:
68+
await showGettingStartedView(context);
69+
break;
70+
default:
71+
await showOverviewPageOnActivation(context);
72+
}
6373
}
6474

6575
async function showExtensionGuide(context: vscode.ExtensionContext) {

src/misc/index.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,22 @@ export enum HelpViewType {
88
Auto = "auto",
99
Overview = "overview",
1010
GettingStarted = "gettingStarted",
11+
None = "none",
1112
}
1213

1314
function showInfoButton() {
1415
const config = vscode.workspace.getConfiguration("java.help");
1516
const firstView = config.get("firstView");
1617

1718
let infoButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
18-
if (firstView === HelpViewType.GettingStarted) {
19-
infoButton.command = "java.gettingStarted";
20-
} else {
21-
infoButton.command = "java.overview";
19+
switch (firstView) {
20+
case HelpViewType.None:
21+
return;
22+
case HelpViewType.GettingStarted:
23+
infoButton.command = "java.gettingStarted";
24+
break;
25+
default:
26+
infoButton.command = "java.overview";
2227
}
2328

2429
infoButton.text = "$(info)";

0 commit comments

Comments
 (0)