@theia/plugin-ext 1.72.0-next.5 → 1.72.0-next.50

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 (34) hide show
  1. package/lib/common/plugin-protocol.d.ts +1 -0
  2. package/lib/common/plugin-protocol.d.ts.map +1 -1
  3. package/lib/common/plugin-protocol.js.map +1 -1
  4. package/lib/hosted/browser/plugin-worker.d.ts.map +1 -1
  5. package/lib/hosted/browser/plugin-worker.js +6 -7
  6. package/lib/hosted/browser/plugin-worker.js.map +1 -1
  7. package/lib/hosted/node/plugin-host-rpc.d.ts +8 -0
  8. package/lib/hosted/node/plugin-host-rpc.d.ts.map +1 -1
  9. package/lib/hosted/node/plugin-host-rpc.js +29 -2
  10. package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
  11. package/lib/hosted/node/plugin-reader.d.ts.map +1 -1
  12. package/lib/hosted/node/plugin-reader.js +1 -0
  13. package/lib/hosted/node/plugin-reader.js.map +1 -1
  14. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  15. package/lib/hosted/node/scanners/scanner-theia.js +17 -1
  16. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  17. package/lib/hosted/node/scanners/scanner-theia.spec.js +81 -0
  18. package/lib/hosted/node/scanners/scanner-theia.spec.js.map +1 -1
  19. package/lib/main/browser/tabs/tabs-main.d.ts +1 -1
  20. package/lib/main/browser/tabs/tabs-main.d.ts.map +1 -1
  21. package/lib/main/browser/tabs/tabs-main.js +6 -1
  22. package/lib/main/browser/tabs/tabs-main.js.map +1 -1
  23. package/lib/plugin/plugin-manager.js +1 -1
  24. package/lib/plugin/plugin-manager.js.map +1 -1
  25. package/package.json +34 -34
  26. package/src/common/plugin-protocol.ts +1 -0
  27. package/src/hosted/browser/plugin-worker.ts +4 -4
  28. package/src/hosted/node/plugin-host-rpc.ts +31 -2
  29. package/src/hosted/node/plugin-reader.ts +1 -0
  30. package/src/hosted/node/scanners/scanner-theia.spec.ts +97 -1
  31. package/src/hosted/node/scanners/scanner-theia.ts +20 -2
  32. package/src/main/browser/style/index.css +4 -4
  33. package/src/main/browser/tabs/tabs-main.ts +9 -4
  34. package/src/plugin/plugin-manager.ts +1 -1
@@ -73,7 +73,8 @@ import { GrammarsReader } from './grammars-reader';
73
73
  import { CharacterPair } from '../../../common/plugin-api-rpc';
74
74
  import { isENOENT } from '../../../common/errors';
75
75
  import * as jsoncparser from 'jsonc-parser';
76
- import { IJSONSchema } from '@theia/core/lib/common/json-schema';
76
+ import { IJSONSchema, JsonType } from '@theia/core/lib/common/json-schema';
77
+ import { JSONValue } from '@theia/core/shared/@lumino/coreutils';
77
78
  import { deepClone } from '@theia/core/lib/common/objects';
78
79
  import { PreferenceSchema, PreferenceDataProperty } from '@theia/core/lib/common/preferences/preference-schema';
79
80
  import { TaskDefinition } from '@theia/task/lib/common/task-protocol';
@@ -90,6 +91,22 @@ function getFileExtension(filePath: string): string {
90
91
  return index === -1 ? '' : filePath.substring(index + 1);
91
92
  }
92
93
 
94
+ /**
95
+ * Mirrors VS Code's `ConfigurationRegistry.getDefaultValue(type)`: plugins expect typed-but-defaultless properties to read as a type-based default, not `undefined`.
96
+ */
97
+ function deriveDefaultForType(type: JsonType | JsonType[] | undefined): JSONValue {
98
+ const t = Array.isArray(type) ? type[0] : type;
99
+ switch (t) {
100
+ case 'boolean': return false;
101
+ case 'integer':
102
+ case 'number': return 0;
103
+ case 'string': return '';
104
+ case 'array': return [];
105
+ case 'object': return {};
106
+ default: return null;
107
+ }
108
+ }
109
+
93
110
  type PluginPackageWithContributes = PluginPackage & { contributes: PluginPackageContribution };
94
111
 
95
112
  type ScopeString = 'machine-overridable' | 'window' | 'resource' | 'language-overridable' | 'application' | 'machine';
@@ -774,7 +791,8 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
774
791
  const schemaProperty: PreferenceDataProperty = {
775
792
  ...property,
776
793
  scope: scopeInfo.scope,
777
- overridable: scopeInfo.overridable
794
+ overridable: scopeInfo.overridable,
795
+ default: property.default !== undefined ? property.default : deriveDefaultForType(property.type)
778
796
  };
779
797
 
780
798
  schema.properties[key] = schemaProperty;
@@ -14,6 +14,10 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
+ @import "./plugin-sidebar.css";
18
+ @import "./webview.css";
19
+ @import "./tree.css";
20
+
17
21
  .spinnerContainer {
18
22
  width: 100%;
19
23
  height: 100%;
@@ -78,7 +82,3 @@
78
82
  background-size: var(--theia-private-sidebar-icon-size) !important;
79
83
  font-size: var(--theia-private-sidebar-icon-size) !important;
80
84
  }
81
-
82
- @import "./plugin-sidebar.css";
83
- @import "./webview.css";
84
- @import "./tree.css";
@@ -101,8 +101,10 @@ export class TabsMainImpl implements TabsMain, Disposable {
101
101
 
102
102
  this.connectToSignal(this.toDisposeOnDestroy, this.applicationShell.mainPanel.widgetRemoved, (mainPanel, widget) => {
103
103
  if (!(widget instanceof TabBar)) {
104
- const tabInfo = this.getOrRebuildModel(this.tabInfoLookup, widget.title)!;
105
- this.onTabClosed(tabInfo, widget.title);
104
+ const tabInfo = this.getOrRebuildModel(this.tabInfoLookup, widget.title);
105
+ if (tabInfo) {
106
+ this.onTabClosed(tabInfo, widget.title);
107
+ }
106
108
  if (this.tabGroupChanged) {
107
109
  this.tabGroupChanged = false;
108
110
  this.createTabsModel();
@@ -268,12 +270,12 @@ export class TabsMainImpl implements TabsMain, Disposable {
268
270
  a.id === b.id;
269
271
  }
270
272
 
271
- protected getOrRebuildModel<T, R>(map: Map<T, R>, key: T): R {
273
+ protected getOrRebuildModel<T, R>(map: Map<T, R>, key: T): R | undefined {
272
274
  // something broke so we rebuild the model
273
275
  let item = map.get(key);
274
276
  if (!item) {
275
277
  this.createTabsModel();
276
- item = map.get(key)!;
278
+ item = map.get(key);
277
279
  }
278
280
  return item;
279
281
  }
@@ -281,6 +283,9 @@ export class TabsMainImpl implements TabsMain, Disposable {
281
283
  // #region event listeners
282
284
  private onTabCreated(tabBar: TabBar<Widget>, args: TabBar.ITabActivateRequestedArgs<Widget>): void {
283
285
  const group = this.getOrRebuildModel(this.tabGroupModel, tabBar);
286
+ if (!group) {
287
+ return;
288
+ }
284
289
  this.connectToSignal(this.getTitleDisposables(args.title), args.title.changed, this.onTabTitleChanged);
285
290
  const tabDto = this.createTabDto(args.title, group.groupId, true);
286
291
  this.tabInfoLookup.set(args.title, { group, tab: tabDto, tabIndex: args.index });
@@ -306,7 +306,7 @@ export abstract class AbstractPluginManagerExtImpl<P extends Record<string, any>
306
306
  }
307
307
  }
308
308
 
309
- let pluginMain = this.host.loadPlugin(plugin);
309
+ let pluginMain = await this.host.loadPlugin(plugin);
310
310
  // see https://github.com/TypeFox/vscode/blob/70b8db24a37fafc77247de7f7cb5bb0195120ed0/src/vs/workbench/api/common/extHostExtensionService.ts#L372-L376
311
311
  pluginMain = pluginMain || {};
312
312
  await this.startPlugin(plugin, configStorage, pluginMain);