@codingame/monaco-vscode-update-service-override 30.0.0 → 31.0.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.
Files changed (23) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/update/common/update.config.contribution.js +23 -46
  3. package/vscode/src/vs/workbench/contrib/markdown/browser/markdownSettingRenderer.js +14 -14
  4. package/vscode/src/vs/workbench/contrib/update/browser/media/postUpdateWidget.css +68 -0
  5. package/vscode/src/vs/workbench/contrib/update/browser/media/updateTitleBarEntry.css +2 -20
  6. package/vscode/src/vs/workbench/contrib/update/browser/media/updateTooltip.css +32 -26
  7. package/vscode/src/vs/workbench/contrib/update/browser/postUpdateWidget.d.ts +35 -0
  8. package/vscode/src/vs/workbench/contrib/update/browser/postUpdateWidget.js +219 -0
  9. package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.d.ts +1 -7
  10. package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.js +5 -177
  11. package/vscode/src/vs/workbench/contrib/update/browser/update.contribution.js +44 -17
  12. package/vscode/src/vs/workbench/contrib/update/browser/update.d.ts +1 -17
  13. package/vscode/src/vs/workbench/contrib/update/browser/update.js +40 -279
  14. package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.d.ts +5 -7
  15. package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.js +83 -78
  16. package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.d.ts +6 -12
  17. package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.js +83 -125
  18. package/vscode/src/vs/workbench/contrib/update/common/updateInfoParser.d.ts +42 -0
  19. package/vscode/src/vs/workbench/contrib/update/common/updateInfoParser.js +74 -0
  20. package/vscode/src/vs/workbench/contrib/update/common/updateUtils.js +9 -21
  21. package/vscode/src/vs/workbench/contrib/update/browser/media/updateStatusBarEntry.css +0 -9
  22. package/vscode/src/vs/workbench/contrib/update/browser/updateStatusBarEntry.d.ts +0 -22
  23. package/vscode/src/vs/workbench/contrib/update/browser/updateStatusBarEntry.js +0 -140
@@ -3,31 +3,35 @@ 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 { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
+ import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
7
+ import { Disposable, MutableDisposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
7
8
  import { isWeb } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
8
9
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
9
10
  import { IActionViewItemService } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/actionViewItemService.service';
10
11
  import { registerAction2, Action2, MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
11
12
  import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
12
- import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
13
13
  import { RawContextKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
14
14
  import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
15
15
  import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
16
16
  import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
17
- import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
18
17
  import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
19
18
  import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
20
19
  import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
21
20
  import { StateType, DisablementReason } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update';
22
21
  import { IUpdateService } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update.service';
23
22
  import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
24
- import { isMajorMinorVersionChange, computeProgressPercent } from '../common/updateUtils.js';
23
+ import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
24
+ import { computeProgressPercent } from '../common/updateUtils.js';
25
+ import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
25
26
  import * as updateTitleBarEntry from './media/updateTitleBarEntry.css';
26
27
  import { UpdateTooltip } from './updateTooltip.js';
28
+ import { waitForState } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils/utilsCancellation';
27
29
 
28
30
  registerCss(updateTitleBarEntry);
29
31
  const UPDATE_TITLE_BAR_ACTION_ID = "workbench.actions.updateIndicator";
30
32
  const UPDATE_TITLE_BAR_CONTEXT = ( new RawContextKey("updateTitleBar", false));
33
+ const DISABLED_REMINDER_LAST_SHOWN_KEY = "update/disabledReminderLastShown";
34
+ const DISABLED_REMINDER_PERIOD = 30 * 24 * 60 * 60 * 1000;
31
35
  const ACTIONABLE_STATES = [StateType.AvailableForDownload, StateType.Downloaded, StateType.Ready];
32
36
  const DETAILED_STATES = [
33
37
  ...ACTIONABLE_STATES,
@@ -36,12 +40,11 @@ const DETAILED_STATES = [
36
40
  StateType.Updating,
37
41
  StateType.Overwriting
38
42
  ];
39
- const LAST_KNOWN_VERSION_KEY = "updateTitleBarEntry/lastKnownVersion";
40
43
  registerAction2(class UpdateIndicatorTitleBarAction extends Action2 {
41
44
  constructor() {
42
45
  super({
43
46
  id: UPDATE_TITLE_BAR_ACTION_ID,
44
- title: ( localize(14876, "Update")),
47
+ title: ( localize(15008, "Update")),
45
48
  f1: false,
46
49
  menu: [{
47
50
  id: MenuId.TitleBarAdjacentCenter,
@@ -55,32 +58,24 @@ registerAction2(class UpdateIndicatorTitleBarAction extends Action2 {
55
58
  let UpdateTitleBarContribution = class UpdateTitleBarContribution extends Disposable {
56
59
  constructor(
57
60
  actionViewItemService,
58
- configurationService,
61
+ chatService,
59
62
  contextKeyService,
60
63
  hostService,
61
64
  instantiationService,
62
- productService,
63
65
  storageService,
64
66
  updateService
65
67
  ) {
66
68
  super();
69
+ this.chatService = chatService;
67
70
  this.hostService = hostService;
68
- this.productService = productService;
69
71
  this.storageService = storageService;
70
- this.mode = "none";
71
72
  this.tooltipVisible = false;
73
+ this.pendingShow = this._register(( new MutableDisposable()));
72
74
  if (isWeb) {
73
75
  return;
74
76
  }
75
77
  this.context = UPDATE_TITLE_BAR_CONTEXT.bindTo(contextKeyService);
76
- this.tooltip = this._register(instantiationService.createInstance(UpdateTooltip, true));
77
- this.mode = configurationService.getValue("update.titleBar");
78
- this._register(configurationService.onDidChangeConfiguration(e => {
79
- if (e.affectsConfiguration("update.titleBar")) {
80
- this.mode = configurationService.getValue("update.titleBar");
81
- this.onStateChange();
82
- }
83
- }));
78
+ this.tooltip = this._register(instantiationService.createInstance(UpdateTooltip));
84
79
  this.state = updateService.state;
85
80
  this._register(updateService.onStateChange(state => {
86
81
  this.state = state;
@@ -92,7 +87,9 @@ let UpdateTitleBarContribution = class UpdateTitleBarContribution extends Dispos
92
87
  (action, options) => {
93
88
  this.entry = instantiationService.createInstance(UpdateTitleBarEntry, action, options, this.tooltip, () => {
94
89
  this.tooltipVisible = false;
95
- this.updateContext();
90
+ if (!ACTIONABLE_STATES.includes(this.state.type) && !DETAILED_STATES.includes(this.state.type)) {
91
+ this.context.set(false);
92
+ }
96
93
  });
97
94
  if (this.tooltipVisible) {
98
95
  this.entry.showTooltip();
@@ -102,80 +99,74 @@ let UpdateTitleBarContribution = class UpdateTitleBarContribution extends Dispos
102
99
  ));
103
100
  void this.onStateChange(true);
104
101
  }
105
- updateContext() {
106
- switch (this.mode) {
107
- case "always":
108
- this.context.set(true);
109
- break;
110
- case "detailed":
111
- this.context.set(DETAILED_STATES.includes(this.state.type));
112
- break;
113
- case "actionable":
114
- this.context.set(ACTIONABLE_STATES.includes(this.state.type));
115
- break;
116
- default:
117
- this.context.set(false);
118
- break;
119
- }
120
- }
121
102
  async onStateChange(startup = false) {
122
- this.updateContext();
123
- if (this.mode === "none") {
124
- return;
103
+ this.pendingShow.clear();
104
+ if (ACTIONABLE_STATES.includes(this.state.type)) {
105
+ await this.setContextWhenChatIdle(true);
106
+ } else {
107
+ this.context.set(false);
125
108
  }
126
109
  if (this.tooltipVisible || !(await this.hostService.hadLastFocus())) {
127
110
  this.tooltip.renderState(this.state);
128
111
  return;
129
112
  }
130
- let showTooltip = startup && this.detectVersionChange();
131
- if (showTooltip) {
132
- this.tooltip.renderPostInstall();
133
- } else {
134
- this.tooltip.renderState(this.state);
135
- switch (this.state.type) {
136
- case StateType.Disabled:
137
- if (startup) {
138
- const reason = this.state.reason;
139
- showTooltip = reason === DisablementReason.InvalidConfiguration || reason === DisablementReason.RunningAsAdmin;
113
+ this.tooltip.renderState(this.state);
114
+ let showTooltip = false;
115
+ switch (this.state.type) {
116
+ case StateType.Disabled:
117
+ if (startup) {
118
+ const reason = this.state.reason;
119
+ if (reason === DisablementReason.InvalidConfiguration || reason === DisablementReason.RunningAsAdmin) {
120
+ const lastShown = this.storageService.getNumber(DISABLED_REMINDER_LAST_SHOWN_KEY, StorageScope.APPLICATION);
121
+ showTooltip = lastShown === undefined || (Date.now() - lastShown) >= DISABLED_REMINDER_PERIOD;
140
122
  }
141
- break;
142
- case StateType.Idle:
143
- showTooltip = !!this.state.error || !!this.state.notAvailable;
144
- break;
145
123
  }
124
+ break;
125
+ case StateType.Idle:
126
+ showTooltip = !!this.state.error;
127
+ break;
128
+ case StateType.Downloading:
129
+ case StateType.Updating:
130
+ case StateType.Overwriting:
131
+ this.context.set(this.state.explicit);
132
+ break;
133
+ case StateType.Restarting:
134
+ this.context.set(true);
135
+ break;
146
136
  }
147
137
  if (showTooltip) {
148
138
  this.tooltipVisible = true;
149
139
  this.context.set(true);
150
140
  this.entry?.showTooltip();
141
+ if (this.state.type === StateType.Disabled) {
142
+ this.storageService.store(
143
+ DISABLED_REMINDER_LAST_SHOWN_KEY,
144
+ Date.now(),
145
+ StorageScope.APPLICATION,
146
+ StorageTarget.MACHINE
147
+ );
148
+ }
151
149
  }
152
150
  }
153
- detectVersionChange() {
154
- let from;
151
+ async setContextWhenChatIdle(value) {
152
+ if (!this.chatService.requestInProgressObs.get()) {
153
+ this.context.set(value);
154
+ return;
155
+ }
156
+ const cts = ( new CancellationTokenSource());
157
+ this.pendingShow.value = toDisposable(() => cts.dispose(true));
155
158
  try {
156
- from = this.storageService.getObject(LAST_KNOWN_VERSION_KEY, StorageScope.APPLICATION);
159
+ await waitForState(
160
+ this.chatService.requestInProgressObs,
161
+ inProgress => !inProgress,
162
+ undefined,
163
+ cts.token
164
+ );
165
+ this.context.set(value);
157
166
  } catch {}
158
- const to = {
159
- version: this.productService.version,
160
- commit: this.productService.commit,
161
- timestamp: Date.now()
162
- };
163
- if (from?.commit === to.commit) {
164
- return false;
165
- }
166
- this.storageService.store(
167
- LAST_KNOWN_VERSION_KEY,
168
- JSON.stringify(to),
169
- StorageScope.APPLICATION,
170
- StorageTarget.MACHINE
171
- );
172
- if (from) {
173
- return isMajorMinorVersionChange(from.version, to.version);
174
- }
175
- return false;
176
167
  }
177
168
  };
178
- UpdateTitleBarContribution = ( __decorate([( __param(0, IActionViewItemService)), ( __param(1, IConfigurationService)), ( __param(2, IContextKeyService)), ( __param(3, IHostService)), ( __param(4, IInstantiationService)), ( __param(5, IProductService)), ( __param(6, IStorageService)), ( __param(7, IUpdateService))], UpdateTitleBarContribution));
169
+ UpdateTitleBarContribution = ( __decorate([( __param(0, IActionViewItemService)), ( __param(1, IChatService)), ( __param(2, IContextKeyService)), ( __param(3, IHostService)), ( __param(4, IInstantiationService)), ( __param(5, IStorageService)), ( __param(6, IUpdateService))], UpdateTitleBarContribution));
179
170
  let UpdateTitleBarEntry = class UpdateTitleBarEntry extends BaseActionViewItem {
180
171
  constructor(
181
172
  action,
@@ -209,16 +200,16 @@ let UpdateTitleBarEntry = class UpdateTitleBarEntry extends BaseActionViewItem {
209
200
  }
210
201
  }
211
202
  showTooltip(focus = false) {
212
- if (!this.content?.isConnected) {
203
+ if (!this.element?.isConnected) {
213
204
  this.showTooltipOnRender = true;
214
205
  return;
215
206
  }
216
207
  this.hoverService.showInstantHover({
217
208
  content: this.tooltip.domNode,
218
209
  target: {
219
- targetElements: [this.content],
210
+ targetElements: [this.element],
220
211
  dispose: () => {
221
- if (!!this.content?.isConnected) {
212
+ if (!!this.element?.isConnected) {
222
213
  this.onUserDismissedTooltip();
223
214
  }
224
215
  }
@@ -265,32 +256,46 @@ let UpdateTitleBarEntry = class UpdateTitleBarEntry extends BaseActionViewItem {
265
256
  this.content.classList.remove("prominent", "progress-indefinite", "progress-percent", "update-disabled");
266
257
  this.content.style.removeProperty("--update-progress");
267
258
  const label = append(this.content, $(".indicator-label"));
268
- label.textContent = ( localize(14877, "Update"));
269
259
  switch (state.type) {
270
260
  case StateType.Disabled:
261
+ label.textContent = ( localize(15009, "Update"));
271
262
  this.content.classList.add("update-disabled");
272
263
  break;
273
264
  case StateType.CheckingForUpdates:
265
+ label.textContent = ( localize(15010, "Checking..."));
266
+ this.renderProgressState(this.content);
267
+ break;
274
268
  case StateType.Overwriting:
269
+ label.textContent = ( localize(15011, "Updating..."));
275
270
  this.renderProgressState(this.content);
276
271
  break;
277
272
  case StateType.AvailableForDownload:
278
273
  case StateType.Downloaded:
279
274
  case StateType.Ready:
275
+ label.textContent = ( localize(15009, "Update"));
280
276
  this.content.classList.add("prominent");
281
277
  break;
282
278
  case StateType.Downloading:
279
+ label.textContent = ( localize(15012, "Downloading..."));
283
280
  this.renderProgressState(
284
281
  this.content,
285
282
  computeProgressPercent(state.downloadedBytes, state.totalBytes)
286
283
  );
287
284
  break;
288
285
  case StateType.Updating:
286
+ label.textContent = ( localize(15013, "Installing..."));
289
287
  this.renderProgressState(
290
288
  this.content,
291
289
  computeProgressPercent(state.currentProgress, state.maxProgress)
292
290
  );
293
291
  break;
292
+ case StateType.Restarting:
293
+ label.textContent = ( localize(15014, "Restarting..."));
294
+ this.renderProgressState(this.content);
295
+ break;
296
+ default:
297
+ label.textContent = ( localize(15009, "Update"));
298
+ break;
294
299
  }
295
300
  }
296
301
  renderProgressState(content, percentage) {
@@ -3,26 +3,19 @@ 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 { IMarkdownRendererService } from "@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer.service";
7
6
  import { IMeteredConnectionService } from "@codingame/monaco-vscode-api/vscode/vs/platform/meteredConnection/common/meteredConnection.service";
8
- import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
9
7
  import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
10
- import { IRequestService } from "@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request.service";
11
8
  import { State } from "@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update";
12
9
  /**
13
10
  * A stateful tooltip control for the update status.
14
11
  */
15
12
  export declare class UpdateTooltip extends Disposable {
16
- private readonly hostedByTitleBar;
17
13
  private readonly clipboardService;
18
14
  private readonly commandService;
19
15
  private readonly configurationService;
20
16
  private readonly hoverService;
21
- private readonly markdownRendererService;
22
17
  private readonly meteredConnectionService;
23
- private readonly openerService;
24
18
  private readonly productService;
25
- private readonly requestService;
26
19
  readonly domNode: HTMLElement;
27
20
  private readonly titleNode;
28
21
  private readonly productInfoNode;
@@ -32,7 +25,6 @@ export declare class UpdateTooltip extends Disposable {
32
25
  private readonly latestVersionNode;
33
26
  private readonly latestVersionCopyValue;
34
27
  private readonly releaseDateNode;
35
- private readonly releaseNotesLink;
36
28
  private readonly progressContainer;
37
29
  private readonly progressFill;
38
30
  private readonly progressPercentNode;
@@ -40,11 +32,12 @@ export declare class UpdateTooltip extends Disposable {
40
32
  private readonly downloadStatsContainer;
41
33
  private readonly timeRemainingNode;
42
34
  private readonly speedInfoNode;
43
- private readonly markdownContainer;
44
- private readonly markdown;
45
35
  private readonly messageNode;
36
+ private readonly buttonBar;
37
+ private readonly releaseNotesButton;
38
+ private readonly actionButton;
46
39
  private releaseNotesVersion;
47
- constructor(hostedByTitleBar: boolean, clipboardService: IClipboardService, commandService: ICommandService, configurationService: IConfigurationService, hoverService: IHoverService, markdownRendererService: IMarkdownRendererService, meteredConnectionService: IMeteredConnectionService, openerService: IOpenerService, productService: IProductService, requestService: IRequestService);
40
+ constructor(clipboardService: IClipboardService, commandService: ICommandService, configurationService: IConfigurationService, hoverService: IHoverService, meteredConnectionService: IMeteredConnectionService, productService: IProductService);
48
41
  private updateCurrentVersion;
49
42
  private hideAll;
50
43
  renderState(state: State): void;
@@ -58,8 +51,9 @@ export declare class UpdateTooltip extends Disposable {
58
51
  private renderUpdating;
59
52
  private renderReady;
60
53
  private renderOverwriting;
61
- renderPostInstall(): Promise<void>;
54
+ private renderRestarting;
62
55
  private renderTitleAndInfo;
56
+ private renderActionButton;
63
57
  private renderMessage;
64
58
  private createVersionRow;
65
59
  private runCommandAndClose;