@codingame/monaco-vscode-update-service-override 36.2.7 → 37.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/platform/update/common/update.config.contribution.js +18 -18
- package/vscode/src/vs/workbench/contrib/markdown/browser/markdownSettingRenderer.js +14 -14
- package/vscode/src/vs/workbench/contrib/update/browser/media/updateTitleBarEntry.css +1 -1
- package/vscode/src/vs/workbench/contrib/update/browser/media/updateTooltip.css +3 -3
- package/vscode/src/vs/workbench/contrib/update/browser/postUpdateWidget.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/update/browser/postUpdateWidget.js +10 -4
- package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.js +5 -5
- package/vscode/src/vs/workbench/contrib/update/browser/update.contribution.js +17 -17
- package/vscode/src/vs/workbench/contrib/update/browser/update.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/update/browser/update.js +42 -31
- package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.d.ts +12 -3
- package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.js +82 -37
- package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.js +59 -58
- package/vscode/src/vs/workbench/contrib/update/common/updateUtils.js +8 -8
- package/vscode/src/vs/platform/assignment/common/assignment.d.ts +0 -95
- package/vscode/src/vs/platform/assignment/common/assignment.js +0 -38
|
@@ -32,8 +32,9 @@ import { Promises, Throttler } from '@codingame/monaco-vscode-api/vscode/vs/base
|
|
|
32
32
|
import { IUserDataSyncWorkbenchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataSync/common/userDataSync.service';
|
|
33
33
|
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
34
34
|
import { IDefaultAccountService } from '@codingame/monaco-vscode-api/vscode/vs/platform/defaultAccount/common/defaultAccount.service';
|
|
35
|
-
import { getInternalOrg } from '
|
|
35
|
+
import { getInternalOrg } from '@codingame/monaco-vscode-api/vscode/vs/platform/assignment/common/assignment';
|
|
36
36
|
import { tryParseVersion } from '../common/updateUtils.js';
|
|
37
|
+
import { UpdateGlobalActivityBadgeVisibleContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/update/common/update';
|
|
37
38
|
|
|
38
39
|
var ProductContribution_1, DefaultAccountUpdateContribution_1;
|
|
39
40
|
const CONTEXT_UPDATE_STATE = ( new RawContextKey("updateState", StateType.Uninitialized));
|
|
@@ -53,7 +54,7 @@ async function openLatestReleaseNotesInBrowser(accessor) {
|
|
|
53
54
|
await openerService.open(uri);
|
|
54
55
|
} else {
|
|
55
56
|
throw ( new Error(( localize(
|
|
56
|
-
|
|
57
|
+
18375,
|
|
57
58
|
"This version of {0} does not have release notes online",
|
|
58
59
|
productService.nameLong
|
|
59
60
|
))));
|
|
@@ -76,7 +77,7 @@ function appendUpdateMenuItems(menuId, group) {
|
|
|
76
77
|
group,
|
|
77
78
|
command: {
|
|
78
79
|
id: "update.check",
|
|
79
|
-
title: ( localize(
|
|
80
|
+
title: ( localize(18376, "Check for Updates..."))
|
|
80
81
|
},
|
|
81
82
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Idle))
|
|
82
83
|
});
|
|
@@ -84,7 +85,7 @@ function appendUpdateMenuItems(menuId, group) {
|
|
|
84
85
|
group,
|
|
85
86
|
command: {
|
|
86
87
|
id: "update.checking",
|
|
87
|
-
title: ( localize(
|
|
88
|
+
title: ( localize(18377, "Checking for Updates...")),
|
|
88
89
|
precondition: ( ContextKeyExpr.false())
|
|
89
90
|
},
|
|
90
91
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.CheckingForUpdates))
|
|
@@ -93,7 +94,7 @@ function appendUpdateMenuItems(menuId, group) {
|
|
|
93
94
|
group,
|
|
94
95
|
command: {
|
|
95
96
|
id: "update.downloadNow",
|
|
96
|
-
title: ( localize(
|
|
97
|
+
title: ( localize(18378, "Download Update (1)"))
|
|
97
98
|
},
|
|
98
99
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.AvailableForDownload))
|
|
99
100
|
});
|
|
@@ -101,7 +102,7 @@ function appendUpdateMenuItems(menuId, group) {
|
|
|
101
102
|
group,
|
|
102
103
|
command: {
|
|
103
104
|
id: "update.downloading",
|
|
104
|
-
title: ( localize(
|
|
105
|
+
title: ( localize(18379, "Downloading Update...")),
|
|
105
106
|
precondition: ( ContextKeyExpr.false())
|
|
106
107
|
},
|
|
107
108
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Downloading))
|
|
@@ -110,7 +111,7 @@ function appendUpdateMenuItems(menuId, group) {
|
|
|
110
111
|
group,
|
|
111
112
|
command: {
|
|
112
113
|
id: "update.install",
|
|
113
|
-
title: ( localize(
|
|
114
|
+
title: ( localize(18380, "Install Update... (1)"))
|
|
114
115
|
},
|
|
115
116
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Downloaded))
|
|
116
117
|
});
|
|
@@ -118,7 +119,7 @@ function appendUpdateMenuItems(menuId, group) {
|
|
|
118
119
|
group,
|
|
119
120
|
command: {
|
|
120
121
|
id: "update.updating",
|
|
121
|
-
title: ( localize(
|
|
122
|
+
title: ( localize(18381, "Installing Update...")),
|
|
122
123
|
precondition: ( ContextKeyExpr.false())
|
|
123
124
|
},
|
|
124
125
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Updating))
|
|
@@ -127,7 +128,7 @@ function appendUpdateMenuItems(menuId, group) {
|
|
|
127
128
|
group,
|
|
128
129
|
command: {
|
|
129
130
|
id: "update.cancelling",
|
|
130
|
-
title: ( localize(
|
|
131
|
+
title: ( localize(18382, "Cancelling Update...")),
|
|
131
132
|
precondition: ( ContextKeyExpr.false())
|
|
132
133
|
},
|
|
133
134
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Cancelling))
|
|
@@ -137,7 +138,7 @@ function appendUpdateMenuItems(menuId, group) {
|
|
|
137
138
|
order: 2,
|
|
138
139
|
command: {
|
|
139
140
|
id: "update.restart",
|
|
140
|
-
title: ( localize(
|
|
141
|
+
title: ( localize(18383, "Restart to Update (1)"))
|
|
141
142
|
},
|
|
142
143
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Ready))
|
|
143
144
|
});
|
|
@@ -179,12 +180,12 @@ let ProductContribution = class ProductContribution {
|
|
|
179
180
|
if (shouldShowReleaseNotes && !shouldShowPostInstallInfo && !environmentService.skipReleaseNotes && releaseNotesUrl && lastVersion && currentVersion && isMajorMinorUpdate(lastVersion, currentVersion)) {
|
|
180
181
|
showReleaseNotesInEditor(instantiationService, productService.version, false).then(undefined, () => {
|
|
181
182
|
notificationService.prompt(Severity.Info, ( localize(
|
|
182
|
-
|
|
183
|
+
18384,
|
|
183
184
|
"Welcome to {0} v{1}! Would you like to read the Release Notes?",
|
|
184
185
|
productService.nameLong,
|
|
185
186
|
productService.version
|
|
186
187
|
)), [{
|
|
187
|
-
label: ( localize(
|
|
188
|
+
label: ( localize(18385, "Release Notes")),
|
|
188
189
|
run: () => {
|
|
189
190
|
const uri = ( URI.parse(releaseNotesUrl));
|
|
190
191
|
openerService.open(uri);
|
|
@@ -220,6 +221,7 @@ let UpdateContribution = class UpdateContribution extends Disposable {
|
|
|
220
221
|
this.dialogService = dialogService;
|
|
221
222
|
this.updateService = updateService;
|
|
222
223
|
this.activityService = activityService;
|
|
224
|
+
this.contextKeyService = contextKeyService;
|
|
223
225
|
this.productService = productService;
|
|
224
226
|
this.hostService = hostService;
|
|
225
227
|
this.badgeDisposable = this._register(( new MutableDisposable()));
|
|
@@ -227,6 +229,12 @@ let UpdateContribution = class UpdateContribution extends Disposable {
|
|
|
227
229
|
this.updateStateContextKey = CONTEXT_UPDATE_STATE.bindTo(contextKeyService);
|
|
228
230
|
this.majorMinorUpdateAvailableContextKey = MAJOR_MINOR_UPDATE_AVAILABLE.bindTo(contextKeyService);
|
|
229
231
|
this._register(updateService.onStateChange(this.onUpdateStateChange, this));
|
|
232
|
+
const updateGlobalActivityBadgeContextKeys = ( new Set(( UpdateGlobalActivityBadgeVisibleContext.keys())));
|
|
233
|
+
this._register(contextKeyService.onDidChangeContext(e => {
|
|
234
|
+
if (e.affectsSome(updateGlobalActivityBadgeContextKeys)) {
|
|
235
|
+
this.updateBadge(this.updateService.state);
|
|
236
|
+
}
|
|
237
|
+
}));
|
|
230
238
|
this.onUpdateStateChange(this.updateService.state);
|
|
231
239
|
const currentVersion = this.productService.commit;
|
|
232
240
|
const lastKnownVersion = storageService.get("update/lastKnownVersion", StorageScope.APPLICATION);
|
|
@@ -241,7 +249,7 @@ let UpdateContribution = class UpdateContribution extends Disposable {
|
|
|
241
249
|
switch (state.type) {
|
|
242
250
|
case StateType.Idle:
|
|
243
251
|
if (state.notAvailable && !state.error && (await this.hostService.hadLastFocus())) {
|
|
244
|
-
this.dialogService.info(( localize(
|
|
252
|
+
this.dialogService.info(( localize(18386, "There are currently no updates available.")));
|
|
245
253
|
}
|
|
246
254
|
break;
|
|
247
255
|
case StateType.Ready:
|
|
@@ -257,25 +265,28 @@ let UpdateContribution = class UpdateContribution extends Disposable {
|
|
|
257
265
|
break;
|
|
258
266
|
}
|
|
259
267
|
}
|
|
260
|
-
|
|
268
|
+
this.updateBadge(state);
|
|
269
|
+
this.state = state;
|
|
270
|
+
}
|
|
271
|
+
updateBadge(state) {
|
|
272
|
+
let badge;
|
|
261
273
|
if (state.type === StateType.AvailableForDownload || state.type === StateType.Downloaded || state.type === StateType.Ready) {
|
|
262
|
-
badge = ( new NumberBadge(1, () => ( localize(
|
|
274
|
+
badge = ( new NumberBadge(1, () => ( localize(18387, "New {0} update available.", this.productService.nameShort))));
|
|
263
275
|
} else if (state.type === StateType.CheckingForUpdates) {
|
|
264
|
-
badge = ( new ProgressBadge(() => ( localize(
|
|
276
|
+
badge = ( new ProgressBadge(() => ( localize(18388, "Checking for {0} updates...", this.productService.nameShort))));
|
|
265
277
|
} else if (state.type === StateType.Downloading || state.type === StateType.Overwriting) {
|
|
266
|
-
badge = ( new ProgressBadge(() => ( localize(
|
|
278
|
+
badge = ( new ProgressBadge(() => ( localize(18389, "Downloading {0} update...", this.productService.nameShort))));
|
|
267
279
|
} else if (state.type === StateType.Updating) {
|
|
268
|
-
badge = ( new ProgressBadge(() => ( localize(
|
|
280
|
+
badge = ( new ProgressBadge(() => ( localize(18390, "Updating {0}...", this.productService.nameShort))));
|
|
269
281
|
} else if (state.type === StateType.Cancelling) {
|
|
270
|
-
badge = ( new ProgressBadge(() => ( localize(
|
|
282
|
+
badge = ( new ProgressBadge(() => ( localize(18391, "Cancelling {0} update...", this.productService.nameShort))));
|
|
271
283
|
}
|
|
272
284
|
this.badgeDisposable.clear();
|
|
273
|
-
if (badge) {
|
|
285
|
+
if (badge && this.contextKeyService.contextMatchesRules(UpdateGlobalActivityBadgeVisibleContext)) {
|
|
274
286
|
this.badgeDisposable.value = this.activityService.showGlobalActivity({
|
|
275
287
|
badge
|
|
276
288
|
});
|
|
277
289
|
}
|
|
278
|
-
this.state = state;
|
|
279
290
|
}
|
|
280
291
|
registerGlobalActivityActions() {
|
|
281
292
|
CommandsRegistry.registerCommand("update.check", () => this.updateService.checkForUpdates(true));
|
|
@@ -305,7 +316,7 @@ let UpdateContribution = class UpdateContribution extends Disposable {
|
|
|
305
316
|
order: 1,
|
|
306
317
|
command: {
|
|
307
318
|
id: "update.showUpdateReleaseNotes",
|
|
308
|
-
title: ( localize(
|
|
319
|
+
title: ( localize(18392, "Show Update Release Notes"))
|
|
309
320
|
},
|
|
310
321
|
when: ( ContextKeyExpr.and(( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Ready)), MAJOR_MINOR_UPDATE_AVAILABLE))
|
|
311
322
|
});
|
|
@@ -331,7 +342,7 @@ let SwitchProductQualityContribution = class SwitchProductQualityContribution ex
|
|
|
331
342
|
constructor() {
|
|
332
343
|
super({
|
|
333
344
|
id: commandId,
|
|
334
|
-
title: isSwitchingToInsiders ? ( localize(
|
|
345
|
+
title: isSwitchingToInsiders ? ( localize(18393, "Switch to Insiders Version...")) : ( localize(18394, "Switch to Stable Version...")),
|
|
335
346
|
precondition: IsWebContext,
|
|
336
347
|
menu: {
|
|
337
348
|
id: MenuId.GlobalActivity,
|
|
@@ -369,15 +380,15 @@ let SwitchProductQualityContribution = class SwitchProductQualityContribution ex
|
|
|
369
380
|
}
|
|
370
381
|
const res = await dialogService.confirm({
|
|
371
382
|
type: "info",
|
|
372
|
-
message: ( localize(
|
|
383
|
+
message: ( localize(18395, "Changing the version requires a reload to take effect")),
|
|
373
384
|
detail: newQuality === "insider" ? ( localize(
|
|
374
|
-
|
|
385
|
+
18396,
|
|
375
386
|
"Press the reload button to switch to the Insiders version of VS Code."
|
|
376
387
|
)) : ( localize(
|
|
377
|
-
|
|
388
|
+
18397,
|
|
378
389
|
"Press the reload button to switch to the Stable version of VS Code."
|
|
379
390
|
)),
|
|
380
|
-
primaryButton: ( localize(
|
|
391
|
+
primaryButton: ( localize(18398, "&&Reload"))
|
|
381
392
|
});
|
|
382
393
|
if (res.confirmed) {
|
|
383
394
|
const promises = [];
|
|
@@ -407,18 +418,18 @@ let SwitchProductQualityContribution = class SwitchProductQualityContribution ex
|
|
|
407
418
|
} = await dialogService.prompt({
|
|
408
419
|
type: Severity.Info,
|
|
409
420
|
message: ( localize(
|
|
410
|
-
|
|
421
|
+
18399,
|
|
411
422
|
"Choose the settings sync service to use after changing the version"
|
|
412
423
|
)),
|
|
413
424
|
detail: ( localize(
|
|
414
|
-
|
|
425
|
+
18400,
|
|
415
426
|
"The Insiders version of VS Code will synchronize your settings, keybindings, extensions, snippets and UI State using separate insiders settings sync service by default."
|
|
416
427
|
)),
|
|
417
428
|
buttons: [{
|
|
418
|
-
label: ( localize(
|
|
429
|
+
label: ( localize(18401, "&&Insiders")),
|
|
419
430
|
run: () => "insiders"
|
|
420
431
|
}, {
|
|
421
|
-
label: ( localize(
|
|
432
|
+
label: ( localize(18402, "&&Stable (current)")),
|
|
422
433
|
run: () => "stable"
|
|
423
434
|
}],
|
|
424
435
|
cancelButton: true
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { BaseActionViewItem, IBaseActionViewItemOptions } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems";
|
|
2
|
-
import { IManagedHoverContent } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hover";
|
|
2
|
+
import { IManagedHoverContent, IManagedHoverOptions } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hover";
|
|
3
3
|
import { IAction } from "@codingame/monaco-vscode-api/vscode/vs/base/common/actions";
|
|
4
|
+
import { AnchorAlignment } from "@codingame/monaco-vscode-api/vscode/vs/base/common/layout";
|
|
4
5
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
5
6
|
import { IActionViewItemService } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/actionViewItemService.service";
|
|
6
7
|
import { IMenuItem, MenuId } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions";
|
|
7
8
|
import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service";
|
|
8
9
|
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
10
|
+
import { ContextKeyExpression } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey";
|
|
9
11
|
import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
10
12
|
import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
|
|
11
13
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
@@ -17,6 +19,7 @@ import { IHostService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/s
|
|
|
17
19
|
import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service";
|
|
18
20
|
import { UpdateTooltip } from "./updateTooltip.js";
|
|
19
21
|
export declare function registerUpdateTitleBarMenuPlacement(menuId: MenuId, item?: Omit<IMenuItem, "command">): void;
|
|
22
|
+
export declare function getAdditionalUpdateTitleBarMenuWhen(when?: ContextKeyExpression): ContextKeyExpression;
|
|
20
23
|
/**
|
|
21
24
|
* Displays update status and actions in the title bar.
|
|
22
25
|
*/
|
|
@@ -29,6 +32,7 @@ export declare class UpdateTitleBarContribution extends Disposable implements IW
|
|
|
29
32
|
private state;
|
|
30
33
|
private entry;
|
|
31
34
|
private tooltipVisible;
|
|
35
|
+
private tooltipFocused;
|
|
32
36
|
constructor(actionViewItemService: IActionViewItemService, chatService: IChatService, configurationService: IConfigurationService, contextKeyService: IContextKeyService, hostService: IHostService, instantiationService: IInstantiationService, storageService: IStorageService, updateService: IUpdateService);
|
|
33
37
|
private createEntry;
|
|
34
38
|
private onStateChange;
|
|
@@ -37,18 +41,23 @@ export declare class UpdateTitleBarContribution extends Disposable implements IW
|
|
|
37
41
|
* Custom action view item for the update indicator in the title bar.
|
|
38
42
|
*/
|
|
39
43
|
export declare class UpdateTitleBarEntry extends BaseActionViewItem {
|
|
44
|
+
private readonly anchorAlignment;
|
|
40
45
|
private readonly tooltip;
|
|
46
|
+
private readonly onDidShowTooltip;
|
|
41
47
|
private readonly onUserDismissedTooltip;
|
|
42
48
|
private readonly commandService;
|
|
43
49
|
private readonly hoverService;
|
|
44
50
|
private readonly telemetryService;
|
|
45
51
|
private readonly updateService;
|
|
46
52
|
private content;
|
|
47
|
-
private
|
|
48
|
-
|
|
53
|
+
private tooltipFocusOnRender;
|
|
54
|
+
private readonly visibleTooltip;
|
|
55
|
+
constructor(action: IAction, options: IBaseActionViewItemOptions, anchorAlignment: AnchorAlignment, tooltip: UpdateTooltip, onDidShowTooltip: (focus: boolean) => void, onUserDismissedTooltip: () => void, commandService: ICommandService, hoverService: IHoverService, telemetryService: ITelemetryService, updateService: IUpdateService);
|
|
49
56
|
render(container: HTMLElement): void;
|
|
50
57
|
showTooltip(focus?: boolean): void;
|
|
58
|
+
private focusTooltip;
|
|
51
59
|
protected getHoverContents(): IManagedHoverContent;
|
|
60
|
+
protected getHoverOptions(): IManagedHoverOptions;
|
|
52
61
|
private runAction;
|
|
53
62
|
private onStateChange;
|
|
54
63
|
private renderProgressState;
|
|
@@ -3,7 +3,8 @@ import { registerCss } from '@codingame/monaco-vscode-api/css';
|
|
|
3
3
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
4
4
|
import { append, $, scheduleAtNextAnimationFrame, getWindow, clearNode } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
5
5
|
import { BaseActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems';
|
|
6
|
-
import {
|
|
6
|
+
import { AnchorAlignment } from '@codingame/monaco-vscode-api/vscode/vs/base/common/layout';
|
|
7
|
+
import { Disposable, MutableDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
8
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
8
9
|
import { isWeb } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
9
10
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
@@ -11,7 +12,7 @@ import { IActionViewItemService } from '@codingame/monaco-vscode-api/vscode/vs/p
|
|
|
11
12
|
import { registerAction2, Action2, MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
12
13
|
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
13
14
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
14
|
-
import
|
|
15
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
15
16
|
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
16
17
|
import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
|
|
17
18
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
@@ -20,9 +21,9 @@ import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform
|
|
|
20
21
|
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
21
22
|
import { StateType, DisablementReason } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update';
|
|
22
23
|
import { IUpdateService } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update.service';
|
|
23
|
-
import { InEditorZenModeContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contextkeys';
|
|
24
24
|
import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
|
|
25
25
|
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
|
|
26
|
+
import { UpdateTitleBarEditorVisibleContext, UpdateTitleBarContext, UpdateTitleBarChatInProgressContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/update/common/update';
|
|
26
27
|
import { computeProgressPercent } from '../common/updateUtils.js';
|
|
27
28
|
import * as updateTitleBarEntry from './media/updateTitleBarEntry.css';
|
|
28
29
|
import { UpdateTooltip } from './updateTooltip.js';
|
|
@@ -30,8 +31,6 @@ import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/obse
|
|
|
30
31
|
|
|
31
32
|
registerCss(updateTitleBarEntry);
|
|
32
33
|
const UPDATE_TITLE_BAR_ACTION_ID = "workbench.actions.updateIndicator";
|
|
33
|
-
const UPDATE_TITLE_BAR_CONTEXT = ( new RawContextKey("updateTitleBar", false));
|
|
34
|
-
const UPDATE_TITLE_BAR_CHAT_IN_PROGRESS_CONTEXT = ( new RawContextKey("updateTitleBarChatRequestInProgress", false));
|
|
35
34
|
const DISABLED_REMINDER_LAST_SHOWN_KEY = "update/disabledReminderLastShown";
|
|
36
35
|
const DISABLED_REMINDER_PERIOD = 30 * 24 * 60 * 60 * 1000;
|
|
37
36
|
const UPDATE_TITLE_BAR_SETTING = "update.titleBar";
|
|
@@ -48,12 +47,12 @@ registerAction2(class UpdateIndicatorTitleBarAction extends Action2 {
|
|
|
48
47
|
constructor() {
|
|
49
48
|
super({
|
|
50
49
|
id: UPDATE_TITLE_BAR_ACTION_ID,
|
|
51
|
-
title: ( localize(
|
|
50
|
+
title: ( localize(18403, "Update")),
|
|
52
51
|
f1: false,
|
|
53
52
|
menu: [{
|
|
54
|
-
id: MenuId.
|
|
53
|
+
id: MenuId.TitleBarUpdate,
|
|
55
54
|
order: 0,
|
|
56
|
-
when:
|
|
55
|
+
when: UpdateTitleBarEditorVisibleContext
|
|
57
56
|
}]
|
|
58
57
|
});
|
|
59
58
|
}
|
|
@@ -75,12 +74,13 @@ let UpdateTitleBarContribution = class UpdateTitleBarContribution extends Dispos
|
|
|
75
74
|
this.hostService = hostService;
|
|
76
75
|
this.storageService = storageService;
|
|
77
76
|
this.tooltipVisible = false;
|
|
77
|
+
this.tooltipFocused = false;
|
|
78
78
|
if (isWeb) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
this.context =
|
|
81
|
+
this.context = UpdateTitleBarContext.bindTo(contextKeyService);
|
|
82
82
|
this.tooltip = this._register(instantiationService.createInstance(UpdateTooltip));
|
|
83
|
-
const chatInProgressContext =
|
|
83
|
+
const chatInProgressContext = UpdateTitleBarChatInProgressContext.bindTo(contextKeyService);
|
|
84
84
|
this._register(autorun(reader => {
|
|
85
85
|
chatInProgressContext.set(chatService.requestInProgressObs.read(reader));
|
|
86
86
|
}));
|
|
@@ -95,31 +95,45 @@ let UpdateTitleBarContribution = class UpdateTitleBarContribution extends Dispos
|
|
|
95
95
|
}
|
|
96
96
|
}));
|
|
97
97
|
this._register(actionViewItemService.register(
|
|
98
|
-
MenuId.
|
|
98
|
+
MenuId.TitleBarUpdate,
|
|
99
99
|
UPDATE_TITLE_BAR_ACTION_ID,
|
|
100
|
-
(action, options) => this.createEntry(instantiationService, action, options)
|
|
100
|
+
(action, options) => this.createEntry(instantiationService, action, options, AnchorAlignment.RIGHT)
|
|
101
101
|
));
|
|
102
102
|
void this.onStateChange(true);
|
|
103
103
|
}
|
|
104
|
-
createEntry(instantiationService, action, options) {
|
|
105
|
-
this.entry = instantiationService.createInstance(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
createEntry(instantiationService, action, options, anchorAlignment) {
|
|
105
|
+
this.entry = instantiationService.createInstance(
|
|
106
|
+
UpdateTitleBarEntry,
|
|
107
|
+
action,
|
|
108
|
+
options,
|
|
109
|
+
anchorAlignment,
|
|
110
|
+
this.tooltip,
|
|
111
|
+
focus => {
|
|
112
|
+
this.tooltipVisible = true;
|
|
113
|
+
this.tooltipFocused = focus;
|
|
114
|
+
},
|
|
115
|
+
() => {
|
|
116
|
+
this.tooltipVisible = false;
|
|
117
|
+
this.tooltipFocused = false;
|
|
118
|
+
if (!ACTIONABLE_STATES.includes(this.state.type) && !DETAILED_STATES.includes(this.state.type)) {
|
|
119
|
+
this.context.set(false);
|
|
120
|
+
}
|
|
109
121
|
}
|
|
110
|
-
|
|
122
|
+
);
|
|
111
123
|
if (this.tooltipVisible) {
|
|
112
|
-
this.entry.showTooltip();
|
|
124
|
+
this.entry.showTooltip(this.tooltipFocused);
|
|
113
125
|
}
|
|
114
126
|
return this.entry;
|
|
115
127
|
}
|
|
116
128
|
async onStateChange(startup = false) {
|
|
117
129
|
if (this.configurationService.getValue(UPDATE_TITLE_BAR_SETTING) === false) {
|
|
130
|
+
this.tooltipVisible = false;
|
|
131
|
+
this.tooltipFocused = false;
|
|
118
132
|
this.context.set(false);
|
|
119
133
|
return;
|
|
120
134
|
}
|
|
121
135
|
if (this.tooltipVisible || !(await this.hostService.hadLastFocus())) {
|
|
122
|
-
this.context.set(ACTIONABLE_STATES.includes(this.state.type));
|
|
136
|
+
this.context.set(this.tooltipVisible || ACTIONABLE_STATES.includes(this.state.type));
|
|
123
137
|
this.tooltip.renderState(this.state);
|
|
124
138
|
return;
|
|
125
139
|
}
|
|
@@ -174,7 +188,9 @@ let UpdateTitleBarEntry = class UpdateTitleBarEntry extends BaseActionViewItem {
|
|
|
174
188
|
constructor(
|
|
175
189
|
action,
|
|
176
190
|
options,
|
|
191
|
+
anchorAlignment,
|
|
177
192
|
tooltip,
|
|
193
|
+
onDidShowTooltip,
|
|
178
194
|
onUserDismissedTooltip,
|
|
179
195
|
commandService,
|
|
180
196
|
hoverService,
|
|
@@ -182,32 +198,41 @@ let UpdateTitleBarEntry = class UpdateTitleBarEntry extends BaseActionViewItem {
|
|
|
182
198
|
updateService
|
|
183
199
|
) {
|
|
184
200
|
super(undefined, action, options);
|
|
201
|
+
this.anchorAlignment = anchorAlignment;
|
|
185
202
|
this.tooltip = tooltip;
|
|
203
|
+
this.onDidShowTooltip = onDidShowTooltip;
|
|
186
204
|
this.onUserDismissedTooltip = onUserDismissedTooltip;
|
|
187
205
|
this.commandService = commandService;
|
|
188
206
|
this.hoverService = hoverService;
|
|
189
207
|
this.telemetryService = telemetryService;
|
|
190
208
|
this.updateService = updateService;
|
|
191
|
-
this.
|
|
209
|
+
this.visibleTooltip = this._register(( new MutableDisposable()));
|
|
192
210
|
this.action.run = () => this.runAction();
|
|
193
211
|
this._register(this.updateService.onStateChange(state => this.onStateChange(state)));
|
|
212
|
+
this._register(this.commandService.onDidExecuteCommand(event => {
|
|
213
|
+
if (event.commandId === "workbench.action.showHover" && this.isFocused()) {
|
|
214
|
+
this.focusTooltip();
|
|
215
|
+
}
|
|
216
|
+
}));
|
|
194
217
|
}
|
|
195
218
|
render(container) {
|
|
196
219
|
super.render(container);
|
|
197
220
|
this.content = append(container, $(".update-indicator"));
|
|
221
|
+
container.setAttribute("role", "button");
|
|
198
222
|
this.updateTooltip();
|
|
199
223
|
this.onStateChange(this.updateService.state);
|
|
200
|
-
if (this.
|
|
201
|
-
|
|
202
|
-
|
|
224
|
+
if (this.tooltipFocusOnRender !== undefined) {
|
|
225
|
+
const focus = this.tooltipFocusOnRender;
|
|
226
|
+
this.tooltipFocusOnRender = undefined;
|
|
227
|
+
scheduleAtNextAnimationFrame(getWindow(container), () => this.showTooltip(focus));
|
|
203
228
|
}
|
|
204
229
|
}
|
|
205
230
|
showTooltip(focus = false) {
|
|
206
231
|
if (!this.element?.isConnected) {
|
|
207
|
-
this.
|
|
232
|
+
this.tooltipFocusOnRender = focus;
|
|
208
233
|
return;
|
|
209
234
|
}
|
|
210
|
-
this.hoverService.showInstantHover({
|
|
235
|
+
const hover = this.hoverService.showInstantHover({
|
|
211
236
|
content: this.tooltip.domNode,
|
|
212
237
|
target: {
|
|
213
238
|
targetElements: [this.element],
|
|
@@ -223,12 +248,31 @@ let UpdateTitleBarEntry = class UpdateTitleBarEntry extends BaseActionViewItem {
|
|
|
223
248
|
appearance: {
|
|
224
249
|
showPointer: true,
|
|
225
250
|
compact: true
|
|
226
|
-
}
|
|
251
|
+
},
|
|
252
|
+
position: {
|
|
253
|
+
anchorAlignment: this.anchorAlignment
|
|
254
|
+
},
|
|
255
|
+
trapFocus: focus
|
|
227
256
|
}, focus);
|
|
257
|
+
if (hover) {
|
|
258
|
+
this.visibleTooltip.value = hover;
|
|
259
|
+
this.onDidShowTooltip(focus);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
focusTooltip() {
|
|
263
|
+
this.visibleTooltip.clear();
|
|
264
|
+
this.showTooltip(true);
|
|
228
265
|
}
|
|
229
266
|
getHoverContents() {
|
|
230
267
|
return this.tooltip.domNode;
|
|
231
268
|
}
|
|
269
|
+
getHoverOptions() {
|
|
270
|
+
return {
|
|
271
|
+
position: {
|
|
272
|
+
anchorAlignment: this.anchorAlignment
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
}
|
|
232
276
|
async runAction() {
|
|
233
277
|
let commandId;
|
|
234
278
|
switch (this.updateService.state.type) {
|
|
@@ -261,49 +305,50 @@ let UpdateTitleBarEntry = class UpdateTitleBarEntry extends BaseActionViewItem {
|
|
|
261
305
|
const label = append(this.content, $(".indicator-label"));
|
|
262
306
|
switch (state.type) {
|
|
263
307
|
case StateType.Disabled:
|
|
264
|
-
label.textContent = ( localize(
|
|
308
|
+
label.textContent = ( localize(18404, "Update"));
|
|
265
309
|
this.content.classList.add("update-disabled");
|
|
266
310
|
break;
|
|
267
311
|
case StateType.CheckingForUpdates:
|
|
268
|
-
label.textContent = ( localize(
|
|
312
|
+
label.textContent = ( localize(18405, "Checking..."));
|
|
269
313
|
this.renderProgressState(this.content);
|
|
270
314
|
break;
|
|
271
315
|
case StateType.Overwriting:
|
|
272
|
-
label.textContent = ( localize(
|
|
316
|
+
label.textContent = ( localize(18406, "Updating..."));
|
|
273
317
|
this.renderProgressState(this.content);
|
|
274
318
|
break;
|
|
275
319
|
case StateType.AvailableForDownload:
|
|
276
320
|
case StateType.Downloaded:
|
|
277
321
|
case StateType.Ready:
|
|
278
|
-
label.textContent = ( localize(
|
|
322
|
+
label.textContent = ( localize(18404, "Update"));
|
|
279
323
|
this.content.classList.add("prominent");
|
|
280
324
|
break;
|
|
281
325
|
case StateType.Downloading:
|
|
282
|
-
label.textContent = ( localize(
|
|
326
|
+
label.textContent = ( localize(18407, "Downloading..."));
|
|
283
327
|
this.renderProgressState(
|
|
284
328
|
this.content,
|
|
285
329
|
computeProgressPercent(state.downloadedBytes, state.totalBytes)
|
|
286
330
|
);
|
|
287
331
|
break;
|
|
288
332
|
case StateType.Updating:
|
|
289
|
-
label.textContent = ( localize(
|
|
333
|
+
label.textContent = ( localize(18408, "Installing..."));
|
|
290
334
|
this.renderProgressState(
|
|
291
335
|
this.content,
|
|
292
336
|
computeProgressPercent(state.currentProgress, state.maxProgress)
|
|
293
337
|
);
|
|
294
338
|
break;
|
|
295
339
|
case StateType.Restarting:
|
|
296
|
-
label.textContent = ( localize(
|
|
340
|
+
label.textContent = ( localize(18409, "Restarting..."));
|
|
297
341
|
this.renderProgressState(this.content);
|
|
298
342
|
break;
|
|
299
343
|
case StateType.Cancelling:
|
|
300
|
-
label.textContent = ( localize(
|
|
344
|
+
label.textContent = ( localize(18410, "Cancelling..."));
|
|
301
345
|
this.renderProgressState(this.content);
|
|
302
346
|
break;
|
|
303
347
|
default:
|
|
304
|
-
label.textContent = ( localize(
|
|
348
|
+
label.textContent = ( localize(18404, "Update"));
|
|
305
349
|
break;
|
|
306
350
|
}
|
|
351
|
+
this.element?.setAttribute("aria-label", label.textContent);
|
|
307
352
|
}
|
|
308
353
|
renderProgressState(content, percentage) {
|
|
309
354
|
if (percentage !== undefined) {
|
|
@@ -314,6 +359,6 @@ let UpdateTitleBarEntry = class UpdateTitleBarEntry extends BaseActionViewItem {
|
|
|
314
359
|
}
|
|
315
360
|
}
|
|
316
361
|
};
|
|
317
|
-
UpdateTitleBarEntry = ( __decorate([( __param(
|
|
362
|
+
UpdateTitleBarEntry = ( __decorate([( __param(6, ICommandService)), ( __param(7, IHoverService)), ( __param(8, ITelemetryService)), ( __param(9, IUpdateService))], UpdateTitleBarEntry));
|
|
318
363
|
|
|
319
364
|
export { UpdateTitleBarContribution, UpdateTitleBarEntry };
|
|
@@ -3,7 +3,6 @@ import { IClipboardService } from "@codingame/monaco-vscode-api/vscode/vs/platfo
|
|
|
3
3
|
import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service";
|
|
4
4
|
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
5
5
|
import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
|
|
6
|
-
import { IMeteredConnectionService } from "@codingame/monaco-vscode-api/vscode/vs/platform/meteredConnection/common/meteredConnection.service";
|
|
7
6
|
import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
|
|
8
7
|
import { State } from "@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update";
|
|
9
8
|
/**
|
|
@@ -14,7 +13,6 @@ export declare class UpdateTooltip extends Disposable {
|
|
|
14
13
|
private readonly commandService;
|
|
15
14
|
private readonly configurationService;
|
|
16
15
|
private readonly hoverService;
|
|
17
|
-
private readonly meteredConnectionService;
|
|
18
16
|
private readonly productService;
|
|
19
17
|
readonly domNode: HTMLElement;
|
|
20
18
|
private readonly titleNode;
|
|
@@ -22,8 +20,10 @@ export declare class UpdateTooltip extends Disposable {
|
|
|
22
20
|
private readonly productNameNode;
|
|
23
21
|
private readonly currentVersionNode;
|
|
24
22
|
private readonly currentVersionCopyValue;
|
|
23
|
+
private readonly currentVersionCopyButton;
|
|
25
24
|
private readonly latestVersionNode;
|
|
26
25
|
private readonly latestVersionCopyValue;
|
|
26
|
+
private readonly latestVersionCopyButton;
|
|
27
27
|
private readonly releaseDateNode;
|
|
28
28
|
private readonly progressContainer;
|
|
29
29
|
private readonly progressFill;
|
|
@@ -37,7 +37,7 @@ export declare class UpdateTooltip extends Disposable {
|
|
|
37
37
|
private readonly releaseNotesButton;
|
|
38
38
|
private readonly actionButton;
|
|
39
39
|
private releaseNotesVersion;
|
|
40
|
-
constructor(clipboardService: IClipboardService, commandService: ICommandService, configurationService: IConfigurationService, hoverService: IHoverService,
|
|
40
|
+
constructor(clipboardService: IClipboardService, commandService: ICommandService, configurationService: IConfigurationService, hoverService: IHoverService, productService: IProductService);
|
|
41
41
|
private updateCurrentVersion;
|
|
42
42
|
private hideAll;
|
|
43
43
|
renderState(state: State): void;
|