forked from microsoft/vscode-java-pack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
53 lines (41 loc) · 1.67 KB
/
Copy pathindex.ts
File metadata and controls
53 lines (41 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
import * as vscode from "vscode";
import { getReleaseNotesEntries, findLatestReleaseNotes, timeToString } from "../utils";
export enum HelpViewType {
Auto = "auto",
Overview = "overview",
GettingStarted = "gettingStarted",
}
function showInfoButton() {
const config = vscode.workspace.getConfiguration("java.help");
const firstView = config.get("firstView");
let infoButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
if (firstView === HelpViewType.GettingStarted) {
infoButton.command = "java.gettingStarted";
} else {
infoButton.command = "java.overview";
}
infoButton.text = "$(info)";
infoButton.tooltip = "Learn more about Java features";
infoButton.show();
}
type ReleaseNotesPresentationHistoryEntry = { version: string, timeStamp: string };
const RELEASE_NOTE_PRESENTATION_HISTORY = "releaseNotesPresentationHistory";
export async function showReleaseNotesOnStart(context: vscode.ExtensionContext) {
const entries = await getReleaseNotesEntries(context);
const latest = findLatestReleaseNotes(entries);
const history: ReleaseNotesPresentationHistoryEntry[] = context.globalState.get(RELEASE_NOTE_PRESENTATION_HISTORY) || [];
if (history.some(entry => entry.version === latest.version)) {
return;
}
await vscode.commands.executeCommand("java.showReleaseNotes", "latest");
history.push({
version: latest.version,
timeStamp: timeToString(new Date())
});
context.globalState.update(RELEASE_NOTE_PRESENTATION_HISTORY, history);
}
export function initialize(context: vscode.ExtensionContext) {
showInfoButton();
}