@codingame/monaco-vscode-extensions-service-override 6.0.2 → 7.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.
@@ -1,21 +1,30 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import { isNonEmptyArray } from 'vscode/vscode/vs/base/common/arrays';
3
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
4
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
5
  import { ExtensionIdentifier } from 'vscode/vscode/vs/platform/extensions/common/extensions';
6
+ import { allApiProposals } from 'vscode/vscode/vs/platform/extensions/common/extensionsApiProposals';
7
+ import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
4
8
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
5
9
  import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
10
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
6
11
  import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
7
- import { allApiProposals } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsApiProposals';
12
+ import { Extensions } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionFeatures';
13
+ import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
8
14
 
15
+ const _moduleId = "vs/workbench/services/extensions/common/extensionsProposedApi";
9
16
  let ExtensionsProposedApi = class ExtensionsProposedApi {
10
17
  constructor(_logService, _environmentService, productService) {
11
18
  this._logService = _logService;
12
19
  this._environmentService = _environmentService;
13
- this._envEnabledExtensions = ( new Set(( (_environmentService.extensionEnabledProposedApi ?? []).map(id => ExtensionIdentifier.toKey(id)))));
20
+ this._envEnabledExtensions = ( (new Set(
21
+ ((_environmentService.extensionEnabledProposedApi ?? []).map(id => ExtensionIdentifier.toKey(id)))
22
+ )));
14
23
  this._envEnablesProposedApiForAll =
15
24
  !_environmentService.isBuilt ||
16
25
  (_environmentService.isExtensionDevelopment && productService.quality !== 'stable') ||
17
26
  (this._envEnabledExtensions.size === 0 && Array.isArray(_environmentService.extensionEnabledProposedApi));
18
- this._productEnabledExtensions = ( new Map());
27
+ this._productEnabledExtensions = ( (new Map()));
19
28
  if (productService.extensionEnabledApiProposals) {
20
29
  for (const [k, value] of Object.entries(productService.extensionEnabledApiProposals)) {
21
30
  const key = ExtensionIdentifier.toKey(k);
@@ -35,9 +44,8 @@ let ExtensionsProposedApi = class ExtensionsProposedApi {
35
44
  this.doUpdateEnabledApiProposals(extension);
36
45
  }
37
46
  }
38
- doUpdateEnabledApiProposals(_extension) {
39
- const extension = _extension;
40
- const key = ExtensionIdentifier.toKey(_extension.identifier);
47
+ doUpdateEnabledApiProposals(extension) {
48
+ const key = ExtensionIdentifier.toKey(extension.identifier);
41
49
  if (isNonEmptyArray(extension.enabledApiProposals)) {
42
50
  extension.enabledApiProposals = extension.enabledApiProposals.filter(name => {
43
51
  const result = Boolean(allApiProposals[name]);
@@ -47,11 +55,11 @@ let ExtensionsProposedApi = class ExtensionsProposedApi {
47
55
  return result;
48
56
  });
49
57
  }
50
- if (( this._productEnabledExtensions.has(key))) {
58
+ if (( (this._productEnabledExtensions.has(key)))) {
51
59
  const productEnabledProposals = this._productEnabledExtensions.get(key);
52
- const productSet = ( new Set(productEnabledProposals));
53
- const extensionSet = ( new Set(extension.enabledApiProposals));
54
- const diff = ( new Set([...extensionSet].filter(a => !( productSet.has(a)))));
60
+ const productSet = ( (new Set(productEnabledProposals)));
61
+ const extensionSet = ( (new Set(extension.enabledApiProposals)));
62
+ const diff = ( (new Set([...extensionSet].filter(a => !( (productSet.has(a)))))));
55
63
  if (diff.size > 0) {
56
64
  this._logService.error(`Extension '${key}' appears in product.json but enables LESS API proposals than the extension wants.\npackage.json (LOSES): ${[...extensionSet].join(', ')}\nproduct.json (WINS): ${[...productSet].join(', ')}`);
57
65
  if (this._environmentService.isExtensionDevelopment) {
@@ -62,7 +70,7 @@ let ExtensionsProposedApi = class ExtensionsProposedApi {
62
70
  extension.enabledApiProposals = productEnabledProposals;
63
71
  return;
64
72
  }
65
- if (this._envEnablesProposedApiForAll || ( this._envEnabledExtensions.has(key))) {
73
+ if (this._envEnablesProposedApiForAll || ( (this._envEnabledExtensions.has(key)))) {
66
74
  return;
67
75
  }
68
76
  if (!extension.isBuiltin && isNonEmptyArray(extension.enabledApiProposals)) {
@@ -71,10 +79,40 @@ let ExtensionsProposedApi = class ExtensionsProposedApi {
71
79
  }
72
80
  }
73
81
  };
74
- ExtensionsProposedApi = ( __decorate([
75
- ( __param(0, ILogService)),
76
- ( __param(1, IWorkbenchEnvironmentService)),
77
- ( __param(2, IProductService))
78
- ], ExtensionsProposedApi));
82
+ ExtensionsProposedApi = ( (__decorate([
83
+ ( (__param(0, ILogService))),
84
+ ( (__param(1, IWorkbenchEnvironmentService))),
85
+ ( (__param(2, IProductService)))
86
+ ], ExtensionsProposedApi)));
87
+ class ApiProposalsMarkdowneRenderer extends Disposable {
88
+ constructor() {
89
+ super(...arguments);
90
+ this.type = 'markdown';
91
+ }
92
+ shouldRender(manifest) {
93
+ return !!manifest.enabledApiProposals?.length;
94
+ }
95
+ render(manifest) {
96
+ const enabledApiProposals = manifest.enabledApiProposals || [];
97
+ const data = ( (new MarkdownString()));
98
+ if (enabledApiProposals.length) {
99
+ for (const proposal of enabledApiProposals) {
100
+ data.appendMarkdown(`- \`${proposal}\`\n`);
101
+ }
102
+ }
103
+ return {
104
+ data,
105
+ dispose: () => { }
106
+ };
107
+ }
108
+ }
109
+ ( (Registry.as(Extensions.ExtensionFeaturesRegistry))).registerExtensionFeature({
110
+ id: 'enabledApiProposals',
111
+ label: ( localizeWithPath(_moduleId, 0, "API Proposals")),
112
+ access: {
113
+ canToggle: false
114
+ },
115
+ renderer: ( (new SyncDescriptor(ApiProposalsMarkdowneRenderer))),
116
+ });
79
117
 
80
118
  export { ExtensionsProposedApi };