@codingame/monaco-vscode-update-service-override 2.2.1 → 3.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.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/markdown/browser/markdownSettingRenderer.js +350 -0
- package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.js +261 -24
- package/vscode/src/vs/workbench/contrib/update/browser/update.contribution.js +48 -15
- package/vscode/src/vs/workbench/contrib/update/browser/update.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-update-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@3.0.0",
|
|
22
22
|
"vscode-marked": "npm:marked@=3.0.2"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { IPreferencesService } from 'vscode/vscode/vs/workbench/services/preferences/common/preferences';
|
|
4
|
+
import { settingKeyToDisplayFormat } from 'vscode/vscode/vs/workbench/contrib/preferences/browser/settingsTreeModels';
|
|
5
|
+
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
6
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
7
|
+
import { DefaultSettings } from 'vscode/vscode/vs/workbench/services/preferences/common/preferencesModels';
|
|
8
|
+
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
|
|
9
|
+
import { ActionViewItem } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionViewItems';
|
|
10
|
+
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
11
|
+
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
|
|
12
|
+
|
|
13
|
+
const codeSettingRegex = /^<code (codesetting)="([^\s"\:]+)(?::([^"]+))?">/;
|
|
14
|
+
const codeFeatureRegex = /^<span (codefeature)="([^\s"\:]+)(?::([^"]+))?">/;
|
|
15
|
+
let SimpleSettingRenderer = class SimpleSettingRenderer {
|
|
16
|
+
constructor(_configurationService, _contextMenuService, _preferencesService, _telemetryService, _clipboardService) {
|
|
17
|
+
this._configurationService = _configurationService;
|
|
18
|
+
this._contextMenuService = _contextMenuService;
|
|
19
|
+
this._preferencesService = _preferencesService;
|
|
20
|
+
this._telemetryService = _telemetryService;
|
|
21
|
+
this._clipboardService = _clipboardService;
|
|
22
|
+
this._updatedSettings = ( new Map());
|
|
23
|
+
this._encounteredSettings = ( new Map());
|
|
24
|
+
this._featuredSettings = ( new Map());
|
|
25
|
+
this.settingsGroups = undefined;
|
|
26
|
+
this._defaultSettings = ( new DefaultSettings([], 2 ));
|
|
27
|
+
}
|
|
28
|
+
get featuredSettingStates() {
|
|
29
|
+
const result = ( new Map());
|
|
30
|
+
for (const [settingId, value] of this._featuredSettings) {
|
|
31
|
+
result.set(settingId, this._configurationService.getValue(settingId) === value);
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
getHtmlRenderer() {
|
|
36
|
+
return (html) => {
|
|
37
|
+
const match = codeSettingRegex.exec(html) ?? codeFeatureRegex.exec(html);
|
|
38
|
+
if (match && match.length === 4) {
|
|
39
|
+
const settingId = match[2];
|
|
40
|
+
const rendered = this.render(settingId, match[3], match[1] === 'codefeature');
|
|
41
|
+
if (rendered) {
|
|
42
|
+
html = html.replace(codeSettingRegex, rendered);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return html;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
settingToUriString(settingId, value) {
|
|
49
|
+
return `${Schemas.codeSetting}://${settingId}${value ? `/${value}` : ''}`;
|
|
50
|
+
}
|
|
51
|
+
featureToUriString(settingId, value) {
|
|
52
|
+
return `${Schemas.codeFeature}://${settingId}${value ? `/${value}` : ''}`;
|
|
53
|
+
}
|
|
54
|
+
getSetting(settingId) {
|
|
55
|
+
if (!this.settingsGroups) {
|
|
56
|
+
this.settingsGroups = this._defaultSettings.getSettingsGroups();
|
|
57
|
+
}
|
|
58
|
+
if (( this._encounteredSettings.has(settingId))) {
|
|
59
|
+
return this._encounteredSettings.get(settingId);
|
|
60
|
+
}
|
|
61
|
+
for (const group of this.settingsGroups) {
|
|
62
|
+
for (const section of group.sections) {
|
|
63
|
+
for (const setting of section.settings) {
|
|
64
|
+
if (setting.key === settingId) {
|
|
65
|
+
this._encounteredSettings.set(settingId, setting);
|
|
66
|
+
return setting;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
parseValue(settingId, value) {
|
|
74
|
+
if (value === 'undefined' || value === '') {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
const setting = this.getSetting(settingId);
|
|
78
|
+
if (!setting) {
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
switch (setting.type) {
|
|
82
|
+
case 'boolean':
|
|
83
|
+
return value === 'true';
|
|
84
|
+
case 'number':
|
|
85
|
+
return parseInt(value, 10);
|
|
86
|
+
case 'string':
|
|
87
|
+
default:
|
|
88
|
+
return value;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
render(settingId, newValue, asFeature) {
|
|
92
|
+
const setting = this.getSetting(settingId);
|
|
93
|
+
if (!setting) {
|
|
94
|
+
return '';
|
|
95
|
+
}
|
|
96
|
+
if (asFeature) {
|
|
97
|
+
return this.renderFeature(setting, newValue);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
return this.renderSetting(setting, newValue);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
viewInSettingsMessage(settingId, alreadyDisplayed) {
|
|
104
|
+
if (alreadyDisplayed) {
|
|
105
|
+
return ( localizeWithPath(
|
|
106
|
+
'vs/workbench/contrib/markdown/browser/markdownSettingRenderer',
|
|
107
|
+
'viewInSettings',
|
|
108
|
+
"View in Settings"
|
|
109
|
+
));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
const displayName = settingKeyToDisplayFormat(settingId);
|
|
113
|
+
return ( localizeWithPath(
|
|
114
|
+
'vs/workbench/contrib/markdown/browser/markdownSettingRenderer',
|
|
115
|
+
'viewInSettingsDetailed',
|
|
116
|
+
"View \"{0}: {1}\" in Settings",
|
|
117
|
+
displayName.category,
|
|
118
|
+
displayName.label
|
|
119
|
+
));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
restorePreviousSettingMessage(settingId) {
|
|
123
|
+
const displayName = settingKeyToDisplayFormat(settingId);
|
|
124
|
+
return ( localizeWithPath(
|
|
125
|
+
'vs/workbench/contrib/markdown/browser/markdownSettingRenderer',
|
|
126
|
+
'restorePreviousValue',
|
|
127
|
+
"Restore value of \"{0}: {1}\"",
|
|
128
|
+
displayName.category,
|
|
129
|
+
displayName.label
|
|
130
|
+
));
|
|
131
|
+
}
|
|
132
|
+
booleanSettingMessage(setting, booleanValue) {
|
|
133
|
+
const currentValue = this._configurationService.getValue(setting.key);
|
|
134
|
+
if (currentValue === booleanValue || (currentValue === undefined && setting.value === booleanValue)) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
const displayName = settingKeyToDisplayFormat(setting.key);
|
|
138
|
+
if (booleanValue) {
|
|
139
|
+
return ( localizeWithPath(
|
|
140
|
+
'vs/workbench/contrib/markdown/browser/markdownSettingRenderer',
|
|
141
|
+
'trueMessage',
|
|
142
|
+
"Enable \"{0}: {1}\"",
|
|
143
|
+
displayName.category,
|
|
144
|
+
displayName.label
|
|
145
|
+
));
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
return ( localizeWithPath(
|
|
149
|
+
'vs/workbench/contrib/markdown/browser/markdownSettingRenderer',
|
|
150
|
+
'falseMessage',
|
|
151
|
+
"Disable \"{0}: {1}\"",
|
|
152
|
+
displayName.category,
|
|
153
|
+
displayName.label
|
|
154
|
+
));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
stringSettingMessage(setting, stringValue) {
|
|
158
|
+
const currentValue = this._configurationService.getValue(setting.key);
|
|
159
|
+
if (currentValue === stringValue || (currentValue === undefined && setting.value === stringValue)) {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
const displayName = settingKeyToDisplayFormat(setting.key);
|
|
163
|
+
return ( localizeWithPath(
|
|
164
|
+
'vs/workbench/contrib/markdown/browser/markdownSettingRenderer',
|
|
165
|
+
'stringValue',
|
|
166
|
+
"Set \"{0}: {1}\" to \"{2}\"",
|
|
167
|
+
displayName.category,
|
|
168
|
+
displayName.label,
|
|
169
|
+
stringValue
|
|
170
|
+
));
|
|
171
|
+
}
|
|
172
|
+
numberSettingMessage(setting, numberValue) {
|
|
173
|
+
const currentValue = this._configurationService.getValue(setting.key);
|
|
174
|
+
if (currentValue === numberValue || (currentValue === undefined && setting.value === numberValue)) {
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
const displayName = settingKeyToDisplayFormat(setting.key);
|
|
178
|
+
return ( localizeWithPath(
|
|
179
|
+
'vs/workbench/contrib/markdown/browser/markdownSettingRenderer',
|
|
180
|
+
'numberValue',
|
|
181
|
+
"Set \"{0}: {1}\" to {2}",
|
|
182
|
+
displayName.category,
|
|
183
|
+
displayName.label,
|
|
184
|
+
numberValue
|
|
185
|
+
));
|
|
186
|
+
}
|
|
187
|
+
renderSetting(setting, newValue) {
|
|
188
|
+
const href = this.settingToUriString(setting.key, newValue);
|
|
189
|
+
const title = ( localizeWithPath(
|
|
190
|
+
'vs/workbench/contrib/markdown/browser/markdownSettingRenderer',
|
|
191
|
+
'changeSettingTitle',
|
|
192
|
+
"View or change setting"
|
|
193
|
+
));
|
|
194
|
+
return `<code tabindex="0"><a href="${href}" class="codesetting" title="${title}" aria-role="button"><svg width="14" height="14" viewBox="0 0 15 15" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M9.1 4.4L8.6 2H7.4l-.5 2.4-.7.3-2-1.3-.9.8 1.3 2-.2.7-2.4.5v1.2l2.4.5.3.8-1.3 2 .8.8 2-1.3.8.3.4 2.3h1.2l.5-2.4.8-.3 2 1.3.8-.8-1.3-2 .3-.8 2.3-.4V7.4l-2.4-.5-.3-.8 1.3-2-.8-.8-2 1.3-.7-.2zM9.4 1l.5 2.4L12 2.1l2 2-1.4 2.1 2.4.4v2.8l-2.4.5L14 12l-2 2-2.1-1.4-.5 2.4H6.6l-.5-2.4L4 13.9l-2-2 1.4-2.1L1 9.4V6.6l2.4-.5L2.1 4l2-2 2.1 1.4.4-2.4h2.8zm.6 7c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zM8 9c.6 0 1-.4 1-1s-.4-1-1-1-1 .4-1 1 .4 1 1 1z"/></svg>
|
|
195
|
+
<span class="separator"></span>
|
|
196
|
+
<span class="setting-name">${setting.key}</span>
|
|
197
|
+
</a></code><code>`;
|
|
198
|
+
}
|
|
199
|
+
renderFeature(setting, newValue) {
|
|
200
|
+
const href = this.featureToUriString(setting.key, newValue);
|
|
201
|
+
const parsedValue = this.parseValue(setting.key, newValue);
|
|
202
|
+
const isChecked = this._configurationService.getValue(setting.key) === parsedValue;
|
|
203
|
+
this._featuredSettings.set(setting.key, parsedValue);
|
|
204
|
+
const title = ( localizeWithPath(
|
|
205
|
+
'vs/workbench/contrib/markdown/browser/markdownSettingRenderer',
|
|
206
|
+
'changeFeatureTitle',
|
|
207
|
+
"Toggle feature with setting {0}",
|
|
208
|
+
setting.key
|
|
209
|
+
));
|
|
210
|
+
return `<span><div class="codefeature-container"><input id="${setting.key}" class="hiddenCheck" type="checkbox" ${isChecked ? 'checked' : ''}><span class="codefeature"><a href="${href}" class="toggle" title="${title}" role="checkbox" aria-checked="${isChecked ? 'true' : 'false'}"></a></span><span class="title"></span></div>`;
|
|
211
|
+
}
|
|
212
|
+
getSettingMessage(setting, newValue) {
|
|
213
|
+
if (setting.type === 'boolean') {
|
|
214
|
+
return this.booleanSettingMessage(setting, newValue);
|
|
215
|
+
}
|
|
216
|
+
else if (setting.type === 'string') {
|
|
217
|
+
return this.stringSettingMessage(setting, newValue);
|
|
218
|
+
}
|
|
219
|
+
else if (setting.type === 'number') {
|
|
220
|
+
return this.numberSettingMessage(setting, newValue);
|
|
221
|
+
}
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
async restoreSetting(settingId) {
|
|
225
|
+
const userOriginalSettingValue = this._updatedSettings.get(settingId);
|
|
226
|
+
this._updatedSettings.delete(settingId);
|
|
227
|
+
return this._configurationService.updateValue(settingId, userOriginalSettingValue, 2 );
|
|
228
|
+
}
|
|
229
|
+
async setSetting(settingId, currentSettingValue, newSettingValue) {
|
|
230
|
+
this._updatedSettings.set(settingId, currentSettingValue);
|
|
231
|
+
return this._configurationService.updateValue(settingId, newSettingValue, 2 );
|
|
232
|
+
}
|
|
233
|
+
getActions(uri) {
|
|
234
|
+
if (uri.scheme !== Schemas.codeSetting) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const actions = [];
|
|
238
|
+
const settingId = uri.authority;
|
|
239
|
+
const newSettingValue = this.parseValue(uri.authority, uri.path.substring(1));
|
|
240
|
+
const currentSettingValue = this._configurationService.inspect(settingId).userValue;
|
|
241
|
+
if ((newSettingValue !== undefined) && newSettingValue === currentSettingValue && ( this._updatedSettings.has(settingId))) {
|
|
242
|
+
const restoreMessage = this.restorePreviousSettingMessage(settingId);
|
|
243
|
+
actions.push({
|
|
244
|
+
class: undefined,
|
|
245
|
+
id: 'restoreSetting',
|
|
246
|
+
enabled: true,
|
|
247
|
+
tooltip: restoreMessage,
|
|
248
|
+
label: restoreMessage,
|
|
249
|
+
run: () => {
|
|
250
|
+
return this.restoreSetting(settingId);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
else if (newSettingValue !== undefined) {
|
|
255
|
+
const setting = this.getSetting(settingId);
|
|
256
|
+
const trySettingMessage = setting ? this.getSettingMessage(setting, newSettingValue) : undefined;
|
|
257
|
+
if (setting && trySettingMessage) {
|
|
258
|
+
actions.push({
|
|
259
|
+
class: undefined,
|
|
260
|
+
id: 'trySetting',
|
|
261
|
+
enabled: currentSettingValue !== newSettingValue,
|
|
262
|
+
tooltip: trySettingMessage,
|
|
263
|
+
label: trySettingMessage,
|
|
264
|
+
run: () => {
|
|
265
|
+
this.setSetting(settingId, currentSettingValue, newSettingValue);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
const viewInSettingsMessage = this.viewInSettingsMessage(settingId, actions.length > 0);
|
|
271
|
+
actions.push({
|
|
272
|
+
class: undefined,
|
|
273
|
+
enabled: true,
|
|
274
|
+
id: 'viewInSettings',
|
|
275
|
+
tooltip: viewInSettingsMessage,
|
|
276
|
+
label: viewInSettingsMessage,
|
|
277
|
+
run: () => {
|
|
278
|
+
return this._preferencesService.openApplicationSettings({ query: `@id:${settingId}` });
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
actions.push({
|
|
282
|
+
class: undefined,
|
|
283
|
+
enabled: true,
|
|
284
|
+
id: 'copySettingId',
|
|
285
|
+
tooltip: ( localizeWithPath(
|
|
286
|
+
'vs/workbench/contrib/markdown/browser/markdownSettingRenderer',
|
|
287
|
+
'copySettingId',
|
|
288
|
+
"Copy Setting ID"
|
|
289
|
+
)),
|
|
290
|
+
label: ( localizeWithPath(
|
|
291
|
+
'vs/workbench/contrib/markdown/browser/markdownSettingRenderer',
|
|
292
|
+
'copySettingId',
|
|
293
|
+
"Copy Setting ID"
|
|
294
|
+
)),
|
|
295
|
+
run: () => {
|
|
296
|
+
this._clipboardService.writeText(settingId);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
return actions;
|
|
300
|
+
}
|
|
301
|
+
showContextMenu(uri, x, y) {
|
|
302
|
+
const actions = this.getActions(uri);
|
|
303
|
+
if (!actions) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
this._contextMenuService.showContextMenu({
|
|
307
|
+
getAnchor: () => ({ x, y }),
|
|
308
|
+
getActions: () => actions,
|
|
309
|
+
getActionViewItem: (action) => {
|
|
310
|
+
return ( new ActionViewItem(action, action, { label: true }));
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
async setFeatureState(uri) {
|
|
315
|
+
const settingId = uri.authority;
|
|
316
|
+
const newSettingValue = this.parseValue(uri.authority, uri.path.substring(1));
|
|
317
|
+
let valueToSetSetting;
|
|
318
|
+
if (( this._updatedSettings.has(settingId))) {
|
|
319
|
+
valueToSetSetting = this._updatedSettings.get(settingId);
|
|
320
|
+
this._updatedSettings.delete(settingId);
|
|
321
|
+
}
|
|
322
|
+
else if (newSettingValue !== this._configurationService.getValue(settingId)) {
|
|
323
|
+
valueToSetSetting = newSettingValue;
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
valueToSetSetting = undefined;
|
|
327
|
+
}
|
|
328
|
+
await this._configurationService.updateValue(settingId, valueToSetSetting, 2 );
|
|
329
|
+
}
|
|
330
|
+
async updateSetting(uri, x, y) {
|
|
331
|
+
if (uri.scheme === Schemas.codeSetting) {
|
|
332
|
+
this._telemetryService.publicLog2('releaseNotesSettingAction', {
|
|
333
|
+
settingId: uri.authority
|
|
334
|
+
});
|
|
335
|
+
return this.showContextMenu(uri, x, y);
|
|
336
|
+
}
|
|
337
|
+
else if (uri.scheme === Schemas.codeFeature) {
|
|
338
|
+
return this.setFeatureState(uri);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
SimpleSettingRenderer = ( __decorate([
|
|
343
|
+
( __param(0, IConfigurationService)),
|
|
344
|
+
( __param(1, IContextMenuService)),
|
|
345
|
+
( __param(2, IPreferencesService)),
|
|
346
|
+
( __param(3, ITelemetryService)),
|
|
347
|
+
( __param(4, IClipboardService))
|
|
348
|
+
], SimpleSettingRenderer));
|
|
349
|
+
|
|
350
|
+
export { SimpleSettingRenderer };
|
|
@@ -24,9 +24,13 @@ import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extension
|
|
|
24
24
|
import { supportsTelemetry, getTelemetryLevel } from 'vscode/vscode/vs/platform/telemetry/common/telemetryUtils';
|
|
25
25
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
26
26
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
27
|
+
import { SimpleSettingRenderer } from '../../markdown/browser/markdownSettingRenderer.js';
|
|
28
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
29
|
+
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
30
|
+
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
27
31
|
|
|
28
32
|
let ReleaseNotesManager = class ReleaseNotesManager {
|
|
29
|
-
constructor(_environmentService, _keybindingService, _languageService, _openerService, _requestService, _configurationService, _editorService, _editorGroupService, _webviewWorkbenchService, _extensionService, _productService) {
|
|
33
|
+
constructor(_environmentService, _keybindingService, _languageService, _openerService, _requestService, _configurationService, _editorService, _editorGroupService, _codeEditorService, _webviewWorkbenchService, _extensionService, _productService, _instantiationService) {
|
|
30
34
|
this._environmentService = _environmentService;
|
|
31
35
|
this._keybindingService = _keybindingService;
|
|
32
36
|
this._languageService = _languageService;
|
|
@@ -35,26 +39,34 @@ let ReleaseNotesManager = class ReleaseNotesManager {
|
|
|
35
39
|
this._configurationService = _configurationService;
|
|
36
40
|
this._editorService = _editorService;
|
|
37
41
|
this._editorGroupService = _editorGroupService;
|
|
42
|
+
this._codeEditorService = _codeEditorService;
|
|
38
43
|
this._webviewWorkbenchService = _webviewWorkbenchService;
|
|
39
44
|
this._extensionService = _extensionService;
|
|
40
45
|
this._productService = _productService;
|
|
46
|
+
this._instantiationService = _instantiationService;
|
|
41
47
|
this._releaseNotesCache = ( new Map());
|
|
42
48
|
this._currentReleaseNotes = undefined;
|
|
43
49
|
this.disposables = ( new DisposableStore());
|
|
44
|
-
TokenizationRegistry.onDidChange(
|
|
45
|
-
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const html = await this.renderBody(this._lastText);
|
|
49
|
-
if (this._currentReleaseNotes) {
|
|
50
|
-
this._currentReleaseNotes.webview.setHtml(html);
|
|
51
|
-
}
|
|
50
|
+
TokenizationRegistry.onDidChange(() => {
|
|
51
|
+
return this.updateHtml();
|
|
52
52
|
});
|
|
53
53
|
_configurationService.onDidChangeConfiguration(this.onDidChangeConfiguration, this, this.disposables);
|
|
54
54
|
_webviewWorkbenchService.onDidChangeActiveWebviewEditor(this.onDidChangeActiveWebviewEditor, this, this.disposables);
|
|
55
|
+
this._simpleSettingRenderer = this._instantiationService.createInstance(SimpleSettingRenderer);
|
|
56
|
+
}
|
|
57
|
+
async updateHtml() {
|
|
58
|
+
if (!this._currentReleaseNotes || !this._lastText) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const captureScroll = this.scrollPosition;
|
|
62
|
+
const html = await this.renderBody(this._lastText);
|
|
63
|
+
if (this._currentReleaseNotes) {
|
|
64
|
+
this._currentReleaseNotes.webview.setHtml(html);
|
|
65
|
+
this._currentReleaseNotes.webview.postMessage({ type: 'setScroll', value: { scrollPosition: captureScroll } });
|
|
66
|
+
}
|
|
55
67
|
}
|
|
56
|
-
async show(version) {
|
|
57
|
-
const releaseNoteText = await this.loadReleaseNotes(version);
|
|
68
|
+
async show(version, useCurrentFile) {
|
|
69
|
+
const releaseNoteText = await this.loadReleaseNotes(version, useCurrentFile);
|
|
58
70
|
this._lastText = releaseNoteText;
|
|
59
71
|
const html = await this.renderBody(releaseNoteText);
|
|
60
72
|
const title = ( localizeWithPath(
|
|
@@ -89,6 +101,14 @@ let ReleaseNotesManager = class ReleaseNotesManager {
|
|
|
89
101
|
if (e.message.type === 'showReleaseNotes') {
|
|
90
102
|
this._configurationService.updateValue('update.showReleaseNotes', e.message.value);
|
|
91
103
|
}
|
|
104
|
+
else if (e.message.type === 'scroll') {
|
|
105
|
+
this.scrollPosition = e.message.value.scrollPosition;
|
|
106
|
+
}
|
|
107
|
+
else if (e.message.type === 'clickSetting') {
|
|
108
|
+
const x = this._currentReleaseNotes?.webview.container.offsetLeft + e.message.value.x;
|
|
109
|
+
const y = this._currentReleaseNotes?.webview.container.offsetTop + e.message.value.y;
|
|
110
|
+
this._simpleSettingRenderer.updateSetting(( URI.parse(e.message.value.uri)), x, y);
|
|
111
|
+
}
|
|
92
112
|
}));
|
|
93
113
|
disposables.add(this._currentReleaseNotes.onWillDispose(() => {
|
|
94
114
|
disposables.dispose();
|
|
@@ -98,7 +118,7 @@ let ReleaseNotesManager = class ReleaseNotesManager {
|
|
|
98
118
|
}
|
|
99
119
|
return true;
|
|
100
120
|
}
|
|
101
|
-
async loadReleaseNotes(version) {
|
|
121
|
+
async loadReleaseNotes(version, useCurrentFile) {
|
|
102
122
|
const match = /^(\d+\.\d+)\./.exec(version);
|
|
103
123
|
if (!match) {
|
|
104
124
|
throw new Error('not found');
|
|
@@ -150,7 +170,13 @@ let ReleaseNotesManager = class ReleaseNotesManager {
|
|
|
150
170
|
const fetchReleaseNotes = async () => {
|
|
151
171
|
let text;
|
|
152
172
|
try {
|
|
153
|
-
|
|
173
|
+
if (useCurrentFile) {
|
|
174
|
+
const file = this._codeEditorService.getActiveCodeEditor()?.getModel()?.getValue();
|
|
175
|
+
text = file ? file.substring(file.indexOf('#')) : undefined;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
text = await asTextOrError(await this._requestService.request({ url }, CancellationToken.None));
|
|
179
|
+
}
|
|
154
180
|
}
|
|
155
181
|
catch {
|
|
156
182
|
throw new Error('Failed to fetch release notes');
|
|
@@ -160,6 +186,9 @@ let ReleaseNotesManager = class ReleaseNotesManager {
|
|
|
160
186
|
}
|
|
161
187
|
return patchKeybindings(text);
|
|
162
188
|
};
|
|
189
|
+
if (useCurrentFile) {
|
|
190
|
+
return fetchReleaseNotes();
|
|
191
|
+
}
|
|
163
192
|
if (!( this._releaseNotesCache.has(version))) {
|
|
164
193
|
this._releaseNotesCache.set(version, (async () => {
|
|
165
194
|
try {
|
|
@@ -173,10 +202,13 @@ let ReleaseNotesManager = class ReleaseNotesManager {
|
|
|
173
202
|
}
|
|
174
203
|
return this._releaseNotesCache.get(version);
|
|
175
204
|
}
|
|
176
|
-
onDidClickLink(uri) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
.
|
|
205
|
+
async onDidClickLink(uri) {
|
|
206
|
+
if (uri.scheme === Schemas.codeSetting || uri.scheme === Schemas.codeFeature) ;
|
|
207
|
+
else {
|
|
208
|
+
this.addGAParameters(uri, 'ReleaseNotes')
|
|
209
|
+
.then(updated => this._openerService.open(updated, { allowCommands: ['workbench.action.openSettings'] }))
|
|
210
|
+
.then(undefined, onUnexpectedError);
|
|
211
|
+
}
|
|
180
212
|
}
|
|
181
213
|
async addGAParameters(uri, origin, experiment = '1') {
|
|
182
214
|
if (supportsTelemetry(this._productService, this._environmentService) && getTelemetryLevel(this._configurationService) === 3 ) {
|
|
@@ -188,7 +220,7 @@ let ReleaseNotesManager = class ReleaseNotesManager {
|
|
|
188
220
|
}
|
|
189
221
|
async renderBody(text) {
|
|
190
222
|
const nonce = generateUuid();
|
|
191
|
-
const content = await renderMarkdownDocument(text, this._extensionService, this._languageService, false);
|
|
223
|
+
const content = await renderMarkdownDocument(text, this._extensionService, this._languageService, false, undefined, undefined, this._simpleSettingRenderer);
|
|
192
224
|
const colorMap = TokenizationRegistry.getColorMap();
|
|
193
225
|
const css = colorMap ? generateTokensCSSForColorMap(colorMap) : '';
|
|
194
226
|
const showReleaseNotes = Boolean(this._configurationService.getValue('update.showReleaseNotes'));
|
|
@@ -201,6 +233,157 @@ let ReleaseNotesManager = class ReleaseNotesManager {
|
|
|
201
233
|
<style nonce="${nonce}">
|
|
202
234
|
${DEFAULT_MARKDOWN_STYLES}
|
|
203
235
|
${css}
|
|
236
|
+
|
|
237
|
+
/* codesetting */
|
|
238
|
+
|
|
239
|
+
code:has(.codesetting)+code {
|
|
240
|
+
display: none;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
code:has(.codesetting) {
|
|
244
|
+
background-color: var(--vscode-textPreformat-background);
|
|
245
|
+
color: var(--vscode-textPreformat-foreground);
|
|
246
|
+
padding-left: 1px;
|
|
247
|
+
margin-right: 3px;
|
|
248
|
+
padding-right: 0px;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
code:has(.codesetting):focus {
|
|
252
|
+
border: 1px solid var(--vscode-button-border, transparent);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.codesetting {
|
|
256
|
+
color: var(--vscode-textPreformat-foreground);
|
|
257
|
+
padding: 0px 1px 1px 0px;
|
|
258
|
+
font-size: 0px;
|
|
259
|
+
overflow: hidden;
|
|
260
|
+
text-overflow: ellipsis;
|
|
261
|
+
outline-offset: 2px !important;
|
|
262
|
+
box-sizing: border-box;
|
|
263
|
+
text-align: center;
|
|
264
|
+
cursor: pointer;
|
|
265
|
+
display: inline;
|
|
266
|
+
margin-right: 3px;
|
|
267
|
+
}
|
|
268
|
+
.codesetting svg {
|
|
269
|
+
font-size: 12px;
|
|
270
|
+
text-align: center;
|
|
271
|
+
cursor: pointer;
|
|
272
|
+
border: 1px solid var(--vscode-button-secondaryBorder, transparent);
|
|
273
|
+
outline: 1px solid transparent;
|
|
274
|
+
line-height: 9px;
|
|
275
|
+
margin-bottom: -5px;
|
|
276
|
+
padding-left: 0px;
|
|
277
|
+
padding-top: 2px;
|
|
278
|
+
padding-bottom: 2px;
|
|
279
|
+
padding-right: 2px;
|
|
280
|
+
display: inline-block;
|
|
281
|
+
text-decoration: none;
|
|
282
|
+
text-rendering: auto;
|
|
283
|
+
text-transform: none;
|
|
284
|
+
-webkit-font-smoothing: antialiased;
|
|
285
|
+
-moz-osx-font-smoothing: grayscale;
|
|
286
|
+
user-select: none;
|
|
287
|
+
-webkit-user-select: none;
|
|
288
|
+
}
|
|
289
|
+
.codesetting .setting-name {
|
|
290
|
+
font-size: 13px;
|
|
291
|
+
padding-left: 2px;
|
|
292
|
+
padding-right: 3px;
|
|
293
|
+
padding-top: 1px;
|
|
294
|
+
padding-bottom: 1px;
|
|
295
|
+
margin-left: -5px;
|
|
296
|
+
margin-top: -3px;
|
|
297
|
+
}
|
|
298
|
+
.codesetting:hover {
|
|
299
|
+
color: var(--vscode-textPreformat-foreground) !important;
|
|
300
|
+
text-decoration: none !important;
|
|
301
|
+
}
|
|
302
|
+
code:has(.codesetting):hover {
|
|
303
|
+
filter: brightness(140%);
|
|
304
|
+
text-decoration: none !important;
|
|
305
|
+
}
|
|
306
|
+
.codesetting:focus {
|
|
307
|
+
outline: 0 !important;
|
|
308
|
+
text-decoration: none !important;
|
|
309
|
+
color: var(--vscode-button-hoverForeground) !important;
|
|
310
|
+
}
|
|
311
|
+
.codesetting .separator {
|
|
312
|
+
width: 1px;
|
|
313
|
+
height: 14px;
|
|
314
|
+
margin-bottom: -3px;
|
|
315
|
+
display: inline-block;
|
|
316
|
+
background-color: var(--vscode-editor-background);
|
|
317
|
+
font-size: 12px;
|
|
318
|
+
margin-right: 8px;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/* codefeature */
|
|
322
|
+
|
|
323
|
+
.codefeature-container {
|
|
324
|
+
display: flex;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.codefeature {
|
|
328
|
+
position: relative;
|
|
329
|
+
display: inline-block;
|
|
330
|
+
width: 46px;
|
|
331
|
+
height: 24px;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.codefeature-container input {
|
|
335
|
+
display: none;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.toggle {
|
|
339
|
+
position: absolute;
|
|
340
|
+
cursor: pointer;
|
|
341
|
+
top: 0;
|
|
342
|
+
left: 0;
|
|
343
|
+
right: 0;
|
|
344
|
+
bottom: 0;
|
|
345
|
+
background-color: var(--vscode-button-background);
|
|
346
|
+
transition: .4s;
|
|
347
|
+
border-radius: 24px;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.toggle:before {
|
|
351
|
+
position: absolute;
|
|
352
|
+
content: "";
|
|
353
|
+
height: 16px;
|
|
354
|
+
width: 16px;
|
|
355
|
+
left: 4px;
|
|
356
|
+
bottom: 4px;
|
|
357
|
+
background-color: var(--vscode-editor-foreground);
|
|
358
|
+
transition: .4s;
|
|
359
|
+
border-radius: 50%;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
input:checked+.codefeature > .toggle:before {
|
|
363
|
+
transform: translateX(22px);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.codefeature-container:has(input) .title {
|
|
367
|
+
line-height: 30px;
|
|
368
|
+
padding-left: 4px;
|
|
369
|
+
font-weight: bold;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.codefeature-container:has(input:checked) .title:after {
|
|
373
|
+
content: "${( localizeWithPath(
|
|
374
|
+
'vs/workbench/contrib/update/browser/releaseNotesEditor',
|
|
375
|
+
'disableFeature',
|
|
376
|
+
"Disable this feature"
|
|
377
|
+
))}";
|
|
378
|
+
}
|
|
379
|
+
.codefeature-container:has(input:not(:checked)) .title:after {
|
|
380
|
+
content: "${( localizeWithPath(
|
|
381
|
+
'vs/workbench/contrib/update/browser/releaseNotesEditor',
|
|
382
|
+
'enableFeature',
|
|
383
|
+
"Enable this feature"
|
|
384
|
+
))}";
|
|
385
|
+
}
|
|
386
|
+
|
|
204
387
|
header { display: flex; align-items: center; padding-top: 1em; }
|
|
205
388
|
</style>
|
|
206
389
|
</head>
|
|
@@ -237,6 +420,49 @@ let ReleaseNotesManager = class ReleaseNotesManager {
|
|
|
237
420
|
window.addEventListener('message', event => {
|
|
238
421
|
if (event.data.type === 'showReleaseNotes') {
|
|
239
422
|
input.checked = event.data.value;
|
|
423
|
+
} else if (event.data.type === 'setScroll') {
|
|
424
|
+
window.scrollTo(event.data.value.scrollPosition.x, event.data.value.scrollPosition.y);
|
|
425
|
+
} else if (event.data.type === 'setFeaturedSettings') {
|
|
426
|
+
for (const [settingId, value] of event.data.value) {
|
|
427
|
+
const setting = document.getElementById(settingId);
|
|
428
|
+
if (setting instanceof HTMLInputElement) {
|
|
429
|
+
setting.checked = value;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
window.onscroll = () => {
|
|
436
|
+
vscode.postMessage({
|
|
437
|
+
type: 'scroll',
|
|
438
|
+
value: {
|
|
439
|
+
scrollPosition: {
|
|
440
|
+
x: window.scrollX,
|
|
441
|
+
y: window.scrollY
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
window.addEventListener('click', event => {
|
|
448
|
+
const href = event.target.href ?? event.target.parentElement.href ?? event.target.parentElement.parentElement?.href;
|
|
449
|
+
if (href && (href.startsWith('${Schemas.codeSetting}') || href.startsWith('${Schemas.codeFeature}'))) {
|
|
450
|
+
vscode.postMessage({ type: 'clickSetting', value: { uri: href, x: event.clientX, y: event.clientY }});
|
|
451
|
+
if (href.startsWith('${Schemas.codeFeature}')) {
|
|
452
|
+
const featureInput = event.target.parentElement.previousSibling;
|
|
453
|
+
if (featureInput instanceof HTMLInputElement) {
|
|
454
|
+
featureInput.checked = !featureInput.checked;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
window.addEventListener('keypress', event => {
|
|
461
|
+
if (event.keyCode === 13) {
|
|
462
|
+
if (event.target.children.length > 0 && event.target.children[0].href) {
|
|
463
|
+
const clientRect = event.target.getBoundingClientRect();
|
|
464
|
+
vscode.postMessage({ type: 'clickSetting', value: { uri: event.target.children[0].href, x: clientRect.right , y: clientRect.bottom }});
|
|
465
|
+
}
|
|
240
466
|
}
|
|
241
467
|
});
|
|
242
468
|
|
|
@@ -249,15 +475,16 @@ let ReleaseNotesManager = class ReleaseNotesManager {
|
|
|
249
475
|
}
|
|
250
476
|
onDidChangeConfiguration(e) {
|
|
251
477
|
if (e.affectsConfiguration('update.showReleaseNotes')) {
|
|
252
|
-
this.
|
|
478
|
+
this.updateCheckboxWebview();
|
|
253
479
|
}
|
|
254
480
|
}
|
|
255
481
|
onDidChangeActiveWebviewEditor(input) {
|
|
256
482
|
if (input && input === this._currentReleaseNotes) {
|
|
257
|
-
this.
|
|
483
|
+
this.updateCheckboxWebview();
|
|
484
|
+
this.updateFeaturedSettingsWebview();
|
|
258
485
|
}
|
|
259
486
|
}
|
|
260
|
-
|
|
487
|
+
updateCheckboxWebview() {
|
|
261
488
|
if (this._currentReleaseNotes) {
|
|
262
489
|
this._currentReleaseNotes.webview.postMessage({
|
|
263
490
|
type: 'showReleaseNotes',
|
|
@@ -265,6 +492,14 @@ let ReleaseNotesManager = class ReleaseNotesManager {
|
|
|
265
492
|
});
|
|
266
493
|
}
|
|
267
494
|
}
|
|
495
|
+
updateFeaturedSettingsWebview() {
|
|
496
|
+
if (this._currentReleaseNotes) {
|
|
497
|
+
this._currentReleaseNotes.webview.postMessage({
|
|
498
|
+
type: 'setFeaturedSettings',
|
|
499
|
+
value: this._simpleSettingRenderer.featuredSettingStates
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
}
|
|
268
503
|
};
|
|
269
504
|
ReleaseNotesManager = ( __decorate([
|
|
270
505
|
( __param(0, IEnvironmentService)),
|
|
@@ -275,9 +510,11 @@ ReleaseNotesManager = ( __decorate([
|
|
|
275
510
|
( __param(5, IConfigurationService)),
|
|
276
511
|
( __param(6, IEditorService)),
|
|
277
512
|
( __param(7, IEditorGroupsService)),
|
|
278
|
-
( __param(8,
|
|
279
|
-
( __param(9,
|
|
280
|
-
( __param(10,
|
|
513
|
+
( __param(8, ICodeEditorService)),
|
|
514
|
+
( __param(9, IWebviewWorkbenchService)),
|
|
515
|
+
( __param(10, IExtensionService)),
|
|
516
|
+
( __param(11, IProductService)),
|
|
517
|
+
( __param(12, IInstantiationService))
|
|
281
518
|
], ReleaseNotesManager));
|
|
282
519
|
|
|
283
520
|
export { ReleaseNotesManager };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../../../../platform/update/common/update.config.contribution.js';
|
|
2
|
-
import {
|
|
2
|
+
import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
4
4
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
5
5
|
import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
|
|
@@ -11,7 +11,7 @@ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/c
|
|
|
11
11
|
import { isWindows } from 'vscode/vscode/vs/base/common/platform';
|
|
12
12
|
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
13
13
|
import { mnemonicButtonLabel } from 'vscode/vscode/vs/base/common/labels';
|
|
14
|
-
import { ShowCurrentReleaseNotesActionId } from 'vscode/vscode/vs/workbench/contrib/update/common/update';
|
|
14
|
+
import { ShowCurrentReleaseNotesActionId, ShowCurrentReleaseNotesFromCurrentFileActionId } from 'vscode/vscode/vs/workbench/contrib/update/common/update';
|
|
15
15
|
import { IsWebContext } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
|
|
16
16
|
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
17
17
|
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
|
|
@@ -28,7 +28,7 @@ class ShowCurrentReleaseNotesAction extends Action2 {
|
|
|
28
28
|
super({
|
|
29
29
|
id: ShowCurrentReleaseNotesActionId,
|
|
30
30
|
title: {
|
|
31
|
-
|
|
31
|
+
...( localize2WithPath(
|
|
32
32
|
'vs/workbench/contrib/update/browser/update.contribution',
|
|
33
33
|
'showReleaseNotes',
|
|
34
34
|
"Show Release Notes"
|
|
@@ -38,7 +38,6 @@ class ShowCurrentReleaseNotesAction extends Action2 {
|
|
|
38
38
|
{ key: 'mshowReleaseNotes', comment: ['&& denotes a mnemonic'] },
|
|
39
39
|
"Show &&Release Notes"
|
|
40
40
|
)),
|
|
41
|
-
original: 'Show Release Notes'
|
|
42
41
|
},
|
|
43
42
|
category: { value: product.nameShort, original: product.nameShort },
|
|
44
43
|
f1: true,
|
|
@@ -56,7 +55,7 @@ class ShowCurrentReleaseNotesAction extends Action2 {
|
|
|
56
55
|
const productService = accessor.get(IProductService);
|
|
57
56
|
const openerService = accessor.get(IOpenerService);
|
|
58
57
|
try {
|
|
59
|
-
await showReleaseNotesInEditor(instantiationService, productService.version);
|
|
58
|
+
await showReleaseNotesInEditor(instantiationService, productService.version, false);
|
|
60
59
|
}
|
|
61
60
|
catch (err) {
|
|
62
61
|
if (productService.releaseNotesUrl) {
|
|
@@ -68,7 +67,44 @@ class ShowCurrentReleaseNotesAction extends Action2 {
|
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
}
|
|
70
|
+
class ShowCurrentReleaseNotesFromCurrentFileAction extends Action2 {
|
|
71
|
+
constructor() {
|
|
72
|
+
super({
|
|
73
|
+
id: ShowCurrentReleaseNotesFromCurrentFileActionId,
|
|
74
|
+
title: {
|
|
75
|
+
...( localize2WithPath(
|
|
76
|
+
'vs/workbench/contrib/update/browser/update.contribution',
|
|
77
|
+
'showReleaseNotesCurrentFile',
|
|
78
|
+
"Open Current File as Release Notes"
|
|
79
|
+
)),
|
|
80
|
+
mnemonicTitle: ( localizeWithPath(
|
|
81
|
+
'vs/workbench/contrib/update/browser/update.contribution',
|
|
82
|
+
{ key: 'mshowReleaseNotes', comment: ['&& denotes a mnemonic'] },
|
|
83
|
+
"Show &&Release Notes"
|
|
84
|
+
)),
|
|
85
|
+
},
|
|
86
|
+
category: ( localize2WithPath(
|
|
87
|
+
'vs/workbench/contrib/update/browser/update.contribution',
|
|
88
|
+
'developerCategory',
|
|
89
|
+
"Developer"
|
|
90
|
+
)),
|
|
91
|
+
f1: true,
|
|
92
|
+
precondition: RELEASE_NOTES_URL
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async run(accessor) {
|
|
96
|
+
const instantiationService = accessor.get(IInstantiationService);
|
|
97
|
+
const productService = accessor.get(IProductService);
|
|
98
|
+
try {
|
|
99
|
+
await showReleaseNotesInEditor(instantiationService, productService.version, true);
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
throw new Error(localizeWithPath('vs/workbench/contrib/update/browser/update.contribution', 'releaseNotesFromFileNone', "Cannot open the current file as Release Notes"));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
71
106
|
registerAction2(ShowCurrentReleaseNotesAction);
|
|
107
|
+
registerAction2(ShowCurrentReleaseNotesFromCurrentFileAction);
|
|
72
108
|
class CheckForUpdateAction extends Action2 {
|
|
73
109
|
constructor() {
|
|
74
110
|
super({
|
|
@@ -147,15 +183,12 @@ class DownloadAction extends Action2 {
|
|
|
147
183
|
constructor() {
|
|
148
184
|
super({
|
|
149
185
|
id: DownloadAction.ID,
|
|
150
|
-
title:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
)),
|
|
157
|
-
original: `Download ${product.downloadUrl}`
|
|
158
|
-
},
|
|
186
|
+
title: ( localize2WithPath(
|
|
187
|
+
'vs/workbench/contrib/update/browser/update.contribution',
|
|
188
|
+
'openDownloadPage',
|
|
189
|
+
"Download {0}",
|
|
190
|
+
product.nameLong
|
|
191
|
+
)),
|
|
159
192
|
precondition: ( ContextKeyExpr.and(IsWebContext, DOWNLOAD_URL)),
|
|
160
193
|
f1: true,
|
|
161
194
|
menu: [{
|
|
@@ -218,4 +251,4 @@ if (isWindows) {
|
|
|
218
251
|
registerAction2(DeveloperApplyUpdateAction);
|
|
219
252
|
}
|
|
220
253
|
|
|
221
|
-
export { CheckForUpdateAction, ShowCurrentReleaseNotesAction };
|
|
254
|
+
export { CheckForUpdateAction, ShowCurrentReleaseNotesAction, ShowCurrentReleaseNotesFromCurrentFileAction };
|
|
@@ -33,11 +33,11 @@ const MAJOR_MINOR_UPDATE_AVAILABLE = ( new RawContextKey('majorMinorUpdateAvaila
|
|
|
33
33
|
const RELEASE_NOTES_URL = ( new RawContextKey('releaseNotesUrl', ''));
|
|
34
34
|
const DOWNLOAD_URL = ( new RawContextKey('downloadUrl', ''));
|
|
35
35
|
let releaseNotesManager = undefined;
|
|
36
|
-
function showReleaseNotesInEditor(instantiationService, version) {
|
|
36
|
+
function showReleaseNotesInEditor(instantiationService, version, useCurrentFile) {
|
|
37
37
|
if (!releaseNotesManager) {
|
|
38
38
|
releaseNotesManager = instantiationService.createInstance(ReleaseNotesManager);
|
|
39
39
|
}
|
|
40
|
-
return releaseNotesManager.show(version);
|
|
40
|
+
return releaseNotesManager.show(version, useCurrentFile);
|
|
41
41
|
}
|
|
42
42
|
async function openLatestReleaseNotesInBrowser(accessor) {
|
|
43
43
|
const openerService = accessor.get(IOpenerService);
|
|
@@ -53,7 +53,7 @@ async function openLatestReleaseNotesInBrowser(accessor) {
|
|
|
53
53
|
async function showReleaseNotes(accessor, version) {
|
|
54
54
|
const instantiationService = accessor.get(IInstantiationService);
|
|
55
55
|
try {
|
|
56
|
-
await showReleaseNotesInEditor(instantiationService, version);
|
|
56
|
+
await showReleaseNotesInEditor(instantiationService, version, false);
|
|
57
57
|
}
|
|
58
58
|
catch (err) {
|
|
59
59
|
try {
|
|
@@ -102,7 +102,7 @@ let ProductContribution = class ProductContribution {
|
|
|
102
102
|
const shouldShowReleaseNotes = configurationService.getValue('update.showReleaseNotes');
|
|
103
103
|
const releaseNotesUrl = productService.releaseNotesUrl;
|
|
104
104
|
if (shouldShowReleaseNotes && !environmentService.skipReleaseNotes && releaseNotesUrl && lastVersion && currentVersion && isMajorMinorUpdate(lastVersion, currentVersion)) {
|
|
105
|
-
showReleaseNotesInEditor(instantiationService, productService.version)
|
|
105
|
+
showReleaseNotesInEditor(instantiationService, productService.version, false)
|
|
106
106
|
.then(undefined, () => {
|
|
107
107
|
notificationService.prompt(Severity.Info, ( localizeWithPath(
|
|
108
108
|
'vs/workbench/contrib/update/browser/update',
|