@codingame/monaco-vscode-update-service-override 28.4.0 → 29.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 (20) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/update/common/update.config.contribution.js +39 -20
  3. package/vscode/src/vs/workbench/contrib/markdown/browser/markdownSettingRenderer.js +14 -14
  4. package/vscode/src/vs/workbench/contrib/update/browser/media/updateStatusBarEntry.css +0 -133
  5. package/vscode/src/vs/workbench/contrib/update/browser/media/updateTitleBarEntry.css +109 -0
  6. package/vscode/src/vs/workbench/contrib/update/browser/media/updateTooltip.css +159 -0
  7. package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.d.ts +22 -1
  8. package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.js +32 -14
  9. package/vscode/src/vs/workbench/contrib/update/browser/update.contribution.js +19 -17
  10. package/vscode/src/vs/workbench/contrib/update/browser/update.d.ts +5 -1
  11. package/vscode/src/vs/workbench/contrib/update/browser/update.js +132 -94
  12. package/vscode/src/vs/workbench/contrib/update/browser/updateStatusBarEntry.d.ts +9 -55
  13. package/vscode/src/vs/workbench/contrib/update/browser/updateStatusBarEntry.js +64 -395
  14. package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.d.ts +58 -0
  15. package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.js +319 -0
  16. package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.d.ts +66 -0
  17. package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.js +429 -0
  18. package/vscode/src/vs/workbench/contrib/update/common/updateUtils.d.ts +61 -0
  19. package/vscode/src/vs/workbench/contrib/update/common/updateUtils.js +141 -0
  20. package/vscode/src/vs/workbench/contrib/update/browser/media/releasenoteseditor.css +0 -9
@@ -49,4 +49,25 @@ export declare class ReleaseNotesManager extends Disposable {
49
49
  private onDidChangeActiveWebviewEditor;
50
50
  private updateCheckboxWebview;
51
51
  }
52
- export declare function renderReleaseNotesMarkdown(text: string, extensionService: IExtensionService, languageService: ILanguageService, simpleSettingRenderer: SimpleSettingRenderer): Promise<TrustedHTML>;
52
+ /**
53
+ * Processes conditional blocks in the release notes markdown.
54
+ *
55
+ * Conditional blocks use a single HTML comment with the format:
56
+ * ```
57
+ * <!-- %IF CONDITION %
58
+ * Content only visible when CONDITION is active.
59
+ * %ENDIF % -->
60
+ * ```
61
+ *
62
+ * Supported conditions:
63
+ * - `IN_PRODUCT` - Content shown in VS Code (both Stable and Insiders)
64
+ * - `WEB` - Content shown on the website only
65
+ * - `STABLE` - Content shown in VS Code Stable only
66
+ * - `INSIDERS` - Content shown in VS Code Insiders only
67
+ *
68
+ * On the website, the entire block is a single HTML comment, so the
69
+ * content is hidden by default. The website renderer would activate
70
+ * `WEB` blocks by stripping the comment markers.
71
+ */
72
+ export declare function processConditionalBlocks(text: string, activeConditions: ReadonlySet<string>): string;
73
+ export declare function renderReleaseNotesMarkdown(text: string, extensionService: IExtensionService, languageService: ILanguageService, simpleSettingRenderer: SimpleSettingRenderer, quality?: string): Promise<TrustedHTML>;
@@ -1,8 +1,7 @@
1
1
 
2
- import { registerCss } from '@codingame/monaco-vscode-api/css';
3
2
  import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
4
- import * as releasenoteseditor from './media/releasenoteseditor.css';
5
3
  import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
4
+ import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
6
5
  import { onUnexpectedError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
7
6
  import { escapeMarkdownSyntaxTokens } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
8
7
  import { KeybindingParser } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keybindingParser';
@@ -39,7 +38,6 @@ import { StateType } from '@codingame/monaco-vscode-api/vscode/vs/platform/updat
39
38
  import { IUpdateService } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update.service';
40
39
  import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
41
40
 
42
- registerCss(releasenoteseditor);
43
41
  let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
44
42
  constructor(
45
43
  _environmentService,
@@ -114,7 +112,7 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
114
112
  base
115
113
  };
116
114
  const html = await this.renderBody(this._lastMeta);
117
- const title = ( localize(14453, "Release Notes: {0}", version));
115
+ const title = ( localize(14719, "Release Notes: {0}", version));
118
116
  const activeEditorPane = this._editorService.activeEditorPane;
119
117
  if (this._currentReleaseNotes) {
120
118
  this._currentReleaseNotes.setWebviewTitle(title);
@@ -137,7 +135,7 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
137
135
  allowScripts: true
138
136
  },
139
137
  extension: undefined
140
- }, "releaseNotes", title, undefined, {
138
+ }, "releaseNotes", title, Codicon.vscode, {
141
139
  group: ACTIVE_GROUP,
142
140
  preserveFocus: false
143
141
  });
@@ -174,7 +172,7 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
174
172
  const versionLabel = match[1].replace(/\./g, "_");
175
173
  const baseUrl = "https://code.visualstudio.com/raw";
176
174
  const url = `${baseUrl}/v${versionLabel}.md`;
177
- const unassigned = ( localize(14454, "unassigned"));
175
+ const unassigned = ( localize(14720, "unassigned"));
178
176
  const escapeMdHtml = text => {
179
177
  return escape(text).replace(/\\/g, "\\\\");
180
178
  };
@@ -221,7 +219,8 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
221
219
  text = file ? file.substring(file.indexOf("#")) : undefined;
222
220
  } else {
223
221
  text = await asTextOrError(await this._requestService.request({
224
- url
222
+ url,
223
+ callSite: "releaseNotesEditor.fetchReleaseNotes"
225
224
  }, CancellationToken.None));
226
225
  }
227
226
  } catch {
@@ -271,7 +270,8 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
271
270
  fileContent.text,
272
271
  this._extensionService,
273
272
  this._languageService,
274
- this._simpleSettingRenderer
273
+ this._simpleSettingRenderer,
274
+ this._productService.quality
275
275
  );
276
276
  const colorMap = TokenizationRegistry.getColorMap();
277
277
  const css = colorMap ? generateTokensCSSForColorMap(colorMap) : "";
@@ -630,7 +630,7 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
630
630
 
631
631
  const label = document.createElement('label');
632
632
  label.htmlFor = 'showReleaseNotes';
633
- label.textContent = '${( localize(14455, "Show release notes after an update"))}';
633
+ label.textContent = '${( localize(14721, "Show release notes after an update"))}';
634
634
  container.appendChild(label);
635
635
 
636
636
  const beforeElement = document.querySelector("body > h1")?.nextElementSibling;
@@ -726,17 +726,17 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
726
726
  switch (state.type) {
727
727
  case StateType.AvailableForDownload:
728
728
  return {
729
- label: ( localize(14456, "Download Update")),
729
+ label: ( localize(14722, "Download Update")),
730
730
  commandId: "update.downloadNow"
731
731
  };
732
732
  case StateType.Downloaded:
733
733
  return {
734
- label: ( localize(14457, "Install Update")),
734
+ label: ( localize(14723, "Install Update")),
735
735
  commandId: "update.install"
736
736
  };
737
737
  case StateType.Ready:
738
738
  return {
739
- label: ( localize(14458, "Restart to Update")),
739
+ label: ( localize(14724, "Restart to Update")),
740
740
  commandId: "update.restart"
741
741
  };
742
742
  default:
@@ -773,8 +773,26 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
773
773
  }
774
774
  };
775
775
  ReleaseNotesManager = ( __decorate([( __param(0, IEnvironmentService)), ( __param(1, IKeybindingService)), ( __param(2, ILanguageService)), ( __param(3, IOpenerService)), ( __param(4, IRequestService)), ( __param(5, IConfigurationService)), ( __param(6, IEditorService)), ( __param(7, IEditorGroupsService)), ( __param(8, ICodeEditorService)), ( __param(9, IWebviewWorkbenchService)), ( __param(10, IExtensionService)), ( __param(11, IProductService)), ( __param(12, IInstantiationService)), ( __param(13, IUpdateService)), ( __param(14, ICommandService))], ReleaseNotesManager));
776
- async function renderReleaseNotesMarkdown(text, extensionService, languageService, simpleSettingRenderer) {
776
+ function processConditionalBlocks(text, activeConditions) {
777
+ return text.replace(
778
+ /<!--\s*%IF\s+(\w+)\s*%([\s\S]*?)%ENDIF\s*%\s*-->/gi,
779
+ (_match, condition, content) => {
780
+ if (( activeConditions.has(condition.toUpperCase()))) {
781
+ return content;
782
+ }
783
+ return "";
784
+ }
785
+ );
786
+ }
787
+ async function renderReleaseNotesMarkdown(text, extensionService, languageService, simpleSettingRenderer, quality) {
777
788
  text = ( text.toString()).replace(/<!--\s*TOC\s*/gi, "").replace(/\s*Navigation End\s*-->/gi, "");
789
+ const activeConditions = ( new Set(["IN_PRODUCT"]));
790
+ if (quality === "stable") {
791
+ activeConditions.add("STABLE");
792
+ } else if (quality === "insider") {
793
+ activeConditions.add("INSIDERS");
794
+ }
795
+ text = processConditionalBlocks(text, activeConditions);
778
796
  return renderMarkdownDocument(text, extensionService, languageService, {
779
797
  sanitizerConfig: {
780
798
  allowRelativeMediaPaths: true,
@@ -797,4 +815,4 @@ async function renderReleaseNotesMarkdown(text, extensionService, languageServic
797
815
  });
798
816
  }
799
817
 
800
- export { ReleaseNotesManager, renderReleaseNotesMarkdown };
818
+ export { ReleaseNotesManager, processConditionalBlocks, renderReleaseNotesMarkdown };
@@ -6,7 +6,8 @@ import { Extensions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/com
6
6
  import { Categories } from '@codingame/monaco-vscode-api/vscode/vs/platform/action/common/actionCommonCategories';
7
7
  import { Action2, MenuId, registerAction2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
8
8
  import { ProductContribution, UpdateContribution, SwitchProductQualityContribution, DefaultAccountUpdateContribution, showReleaseNotesInEditor, CONTEXT_UPDATE_STATE } from './update.js';
9
- import { UpdateStatusBarEntryContribution } from './updateStatusBarEntry.js';
9
+ import { UpdateStatusBarContribution } from './updateStatusBarEntry.js';
10
+ import { UpdateTitleBarContribution } from './updateTitleBarEntry.js';
10
11
  import { LifecyclePhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
11
12
  import product from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/product';
12
13
  import { StateType } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update';
@@ -26,7 +27,8 @@ workbench.registerWorkbenchContribution(ProductContribution, LifecyclePhase.Rest
26
27
  workbench.registerWorkbenchContribution(UpdateContribution, LifecyclePhase.Restored);
27
28
  workbench.registerWorkbenchContribution(SwitchProductQualityContribution, LifecyclePhase.Restored);
28
29
  workbench.registerWorkbenchContribution(DefaultAccountUpdateContribution, LifecyclePhase.Eventually);
29
- workbench.registerWorkbenchContribution(UpdateStatusBarEntryContribution, LifecyclePhase.Restored);
30
+ workbench.registerWorkbenchContribution(UpdateStatusBarContribution, LifecyclePhase.Restored);
31
+ workbench.registerWorkbenchContribution(UpdateTitleBarContribution, LifecyclePhase.Restored);
30
32
  class ShowReleaseNotesAction extends Action2 {
31
33
  static {
32
34
  this.AVAILABLE = !!product.releaseNotesUrl;
@@ -35,8 +37,8 @@ class ShowReleaseNotesAction extends Action2 {
35
37
  super({
36
38
  id: ShowCurrentReleaseNotesActionId,
37
39
  title: {
38
- ...( localize2(14459, "Show Release Notes")),
39
- mnemonicTitle: ( localize(14460, "Show &&Release Notes"))
40
+ ...( localize2(14725, "Show Release Notes")),
41
+ mnemonicTitle: ( localize(14726, "Show &&Release Notes"))
40
42
  },
41
43
  category: {
42
44
  value: product.nameShort,
@@ -62,7 +64,7 @@ class ShowReleaseNotesAction extends Action2 {
62
64
  await openerService.open(( URI.parse(productService.releaseNotesUrl)));
63
65
  } else {
64
66
  throw ( new Error(( localize(
65
- 14461,
67
+ 14727,
66
68
  "This version of {0} does not have release notes online",
67
69
  productService.nameLong
68
70
  ))));
@@ -75,10 +77,10 @@ class ShowCurrentReleaseNotesFromCurrentFileAction extends Action2 {
75
77
  super({
76
78
  id: ShowCurrentReleaseNotesFromCurrentFileActionId,
77
79
  title: {
78
- ...( localize2(14462, "Open Current File as Release Notes")),
79
- mnemonicTitle: ( localize(14460, "Show &&Release Notes"))
80
+ ...( localize2(14728, "Open Current File as Release Notes")),
81
+ mnemonicTitle: ( localize(14726, "Show &&Release Notes"))
80
82
  },
81
- category: ( localize2(14463, "Developer")),
83
+ category: ( localize2(14729, "Developer")),
82
84
  f1: true
83
85
  });
84
86
  }
@@ -88,7 +90,7 @@ class ShowCurrentReleaseNotesFromCurrentFileAction extends Action2 {
88
90
  try {
89
91
  await showReleaseNotesInEditor(instantiationService, productService.version, true);
90
92
  } catch (err) {
91
- throw ( new Error(( localize(14464, "Cannot open the current file as Release Notes"))));
93
+ throw ( new Error(( localize(14730, "Cannot open the current file as Release Notes"))));
92
94
  }
93
95
  }
94
96
  }
@@ -100,7 +102,7 @@ class CheckForUpdateAction extends Action2 {
100
102
  constructor() {
101
103
  super({
102
104
  id: "update.checkForUpdate",
103
- title: ( localize2(14465, "Check for Updates...")),
105
+ title: ( localize2(14731, "Check for Updates...")),
104
106
  category: {
105
107
  value: product.nameShort,
106
108
  original: product.nameShort
@@ -118,7 +120,7 @@ class DownloadUpdateAction extends Action2 {
118
120
  constructor() {
119
121
  super({
120
122
  id: "update.downloadUpdate",
121
- title: ( localize2(14466, "Download Update")),
123
+ title: ( localize2(14732, "Download Update")),
122
124
  category: {
123
125
  value: product.nameShort,
124
126
  original: product.nameShort
@@ -135,7 +137,7 @@ class InstallUpdateAction extends Action2 {
135
137
  constructor() {
136
138
  super({
137
139
  id: "update.installUpdate",
138
- title: ( localize2(14467, "Install Update")),
140
+ title: ( localize2(14733, "Install Update")),
139
141
  category: {
140
142
  value: product.nameShort,
141
143
  original: product.nameShort
@@ -152,7 +154,7 @@ class RestartToUpdateAction extends Action2 {
152
154
  constructor() {
153
155
  super({
154
156
  id: "update.restartToUpdate",
155
- title: ( localize2(14468, "Restart to Update")),
157
+ title: ( localize2(14734, "Restart to Update")),
156
158
  category: {
157
159
  value: product.nameShort,
158
160
  original: product.nameShort
@@ -175,7 +177,7 @@ class DownloadAction extends Action2 {
175
177
  constructor() {
176
178
  super({
177
179
  id: DownloadAction.ID,
178
- title: ( localize2(14469, "Download {0}", product.nameLong)),
180
+ title: ( localize2(14735, "Download {0}", product.nameLong)),
179
181
  precondition: IsWebContext,
180
182
  f1: true,
181
183
  menu: [{
@@ -204,7 +206,7 @@ if (isWindows) {
204
206
  constructor() {
205
207
  super({
206
208
  id: "_update.applyupdate",
207
- title: ( localize2(14470, "Apply Update...")),
209
+ title: ( localize2(14736, "Apply Update...")),
208
210
  category: Categories.Developer,
209
211
  f1: true,
210
212
  precondition: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Idle))
@@ -214,13 +216,13 @@ if (isWindows) {
214
216
  const updateService = accessor.get(IUpdateService);
215
217
  const fileDialogService = accessor.get(IFileDialogService);
216
218
  const updatePath = await fileDialogService.showOpenDialog({
217
- title: ( localize(14471, "Apply Update")),
219
+ title: ( localize(14737, "Apply Update")),
218
220
  filters: [{
219
221
  name: "Setup",
220
222
  extensions: ["exe"]
221
223
  }],
222
224
  canSelectFiles: true,
223
- openLabel: mnemonicButtonLabel(( localize(14472, "&&Update")))
225
+ openLabel: mnemonicButtonLabel(( localize(14738, "&&Update")))
224
226
  });
225
227
  if (!updatePath || !updatePath[0]) {
226
228
  return;
@@ -15,6 +15,7 @@ import { MenuId } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/
15
15
  import { IHostService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service";
16
16
  import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
17
17
  import { IDefaultAccountService } from "@codingame/monaco-vscode-api/vscode/vs/platform/defaultAccount/common/defaultAccount.service";
18
+ import { IWorkbenchLayoutService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service";
18
19
  export declare const CONTEXT_UPDATE_STATE: RawContextKey<string>;
19
20
  export declare const MAJOR_MINOR_UPDATE_AVAILABLE: RawContextKey<boolean>;
20
21
  export declare function showReleaseNotesInEditor(instantiationService: IInstantiationService, version: string, useCurrentFile: boolean): Promise<boolean>;
@@ -41,12 +42,15 @@ export declare class UpdateContribution extends Disposable implements IWorkbench
41
42
  private readonly openerService;
42
43
  private readonly configurationService;
43
44
  private readonly hostService;
45
+ private readonly layoutService;
44
46
  private state;
45
47
  private readonly badgeDisposable;
46
48
  private overwriteNotificationHandle;
47
49
  private updateStateContextKey;
48
50
  private majorMinorUpdateAvailableContextKey;
49
- constructor(storageService: IStorageService, instantiationService: IInstantiationService, notificationService: INotificationService, dialogService: IDialogService, updateService: IUpdateService, activityService: IActivityService, contextKeyService: IContextKeyService, productService: IProductService, openerService: IOpenerService, configurationService: IConfigurationService, hostService: IHostService);
51
+ private titleBarEnabled;
52
+ constructor(storageService: IStorageService, instantiationService: IInstantiationService, notificationService: INotificationService, dialogService: IDialogService, updateService: IUpdateService, activityService: IActivityService, contextKeyService: IContextKeyService, productService: IProductService, openerService: IOpenerService, configurationService: IConfigurationService, hostService: IHostService, layoutService: IWorkbenchLayoutService);
53
+ private isTitleBarEnabled;
50
54
  private onUpdateStateChange;
51
55
  private onError;
52
56
  private onUpdateNotAvailable;