@theia/plugin-ext 1.65.0-next.19 → 1.65.0-next.39

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 (112) hide show
  1. package/lib/common/plugin-protocol.d.ts +5 -5
  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/hosted-plugin.d.ts +1 -1
  5. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  6. package/lib/hosted/browser/hosted-plugin.js +1 -1
  7. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  8. package/lib/hosted/node/scanners/scanner-theia.d.ts +41 -0
  9. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  10. package/lib/hosted/node/scanners/scanner-theia.js +38 -5
  11. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  12. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts +2 -1
  13. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
  14. package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
  15. package/lib/main/browser/custom-editors/custom-editors-main.d.ts +1 -1
  16. package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
  17. package/lib/main/browser/custom-editors/custom-editors-main.js +2 -2
  18. package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
  19. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts +2 -1
  20. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts.map +1 -1
  21. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js +1 -1
  22. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js.map +1 -1
  23. package/lib/main/browser/debug/debug-main.js +1 -1
  24. package/lib/main/browser/debug/debug-main.js.map +1 -1
  25. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +1 -1
  26. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  27. package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
  28. package/lib/main/browser/menus/menus-contribution-handler.js +1 -1
  29. package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
  30. package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts.map +1 -1
  31. package/lib/main/browser/menus/vscode-theia-menu-mappings.js +1 -0
  32. package/lib/main/browser/menus/vscode-theia-menu-mappings.js.map +1 -1
  33. package/lib/main/browser/plugin-contribution-handler.d.ts +2 -3
  34. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  35. package/lib/main/browser/plugin-contribution-handler.js +11 -28
  36. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  37. package/lib/main/browser/plugin-ext-argument-processor.d.ts +12 -0
  38. package/lib/main/browser/plugin-ext-argument-processor.d.ts.map +1 -0
  39. package/lib/main/browser/plugin-ext-argument-processor.js +41 -0
  40. package/lib/main/browser/plugin-ext-argument-processor.js.map +1 -0
  41. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  42. package/lib/main/browser/plugin-ext-frontend-module.js +7 -1
  43. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  44. package/lib/main/browser/preference-registry-main.d.ts +1 -1
  45. package/lib/main/browser/preference-registry-main.d.ts.map +1 -1
  46. package/lib/main/browser/preference-registry-main.js +10 -8
  47. package/lib/main/browser/preference-registry-main.js.map +1 -1
  48. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  49. package/lib/main/browser/view/plugin-view-registry.js +3 -0
  50. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  51. package/lib/main/browser/view/tree-views-main.js +1 -1
  52. package/lib/main/browser/view/tree-views-main.js.map +1 -1
  53. package/lib/main/browser/webview/webview-frontend-preference-contribution.d.ts +5 -0
  54. package/lib/main/browser/webview/webview-frontend-preference-contribution.d.ts.map +1 -0
  55. package/lib/main/browser/webview/webview-frontend-preference-contribution.js +40 -0
  56. package/lib/main/browser/webview/webview-frontend-preference-contribution.js.map +1 -0
  57. package/lib/main/browser/webview/webview-theme-data-provider.d.ts +1 -1
  58. package/lib/main/browser/webview/webview-theme-data-provider.d.ts.map +1 -1
  59. package/lib/main/browser/webview/webview-theme-data-provider.js +1 -1
  60. package/lib/main/browser/webview/webview-theme-data-provider.js.map +1 -1
  61. package/lib/main/browser/webview/webview.d.ts +1 -1
  62. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  63. package/lib/main/browser/webview/webview.js +1 -1
  64. package/lib/main/browser/webview/webview.js.map +1 -1
  65. package/lib/main/browser/workspace-main.js +3 -3
  66. package/lib/main/browser/workspace-main.js.map +1 -1
  67. package/lib/main/{browser/webview → common}/webview-preferences.d.ts +1 -1
  68. package/lib/main/common/webview-preferences.d.ts.map +1 -0
  69. package/lib/main/{browser/webview → common}/webview-preferences.js +1 -12
  70. package/lib/main/common/webview-preferences.js.map +1 -0
  71. package/lib/main/node/plugin-ext-backend-module.d.ts.map +1 -1
  72. package/lib/main/node/plugin-ext-backend-module.js +2 -0
  73. package/lib/main/node/plugin-ext-backend-module.js.map +1 -1
  74. package/lib/plugin/plugin-context.js +1 -1
  75. package/lib/plugin/plugin-context.js.map +1 -1
  76. package/lib/plugin/status-bar/status-bar-item.d.ts +3 -1
  77. package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
  78. package/lib/plugin/status-bar/status-bar-item.js +46 -1
  79. package/lib/plugin/status-bar/status-bar-item.js.map +1 -1
  80. package/lib/plugin/status-bar-message-registry.d.ts +3 -1
  81. package/lib/plugin/status-bar-message-registry.d.ts.map +1 -1
  82. package/lib/plugin/status-bar-message-registry.js +3 -2
  83. package/lib/plugin/status-bar-message-registry.js.map +1 -1
  84. package/package.json +29 -29
  85. package/src/common/plugin-protocol.ts +5 -5
  86. package/src/hosted/browser/hosted-plugin.ts +1 -1
  87. package/src/hosted/node/scanners/scanner-theia.ts +87 -5
  88. package/src/main/browser/custom-editors/custom-editor-opener.tsx +2 -2
  89. package/src/main/browser/custom-editors/custom-editors-main.ts +1 -1
  90. package/src/main/browser/custom-editors/plugin-custom-editor-registry.ts +2 -2
  91. package/src/main/browser/debug/debug-main.ts +1 -1
  92. package/src/main/browser/debug/plugin-debug-session-factory.ts +1 -1
  93. package/src/main/browser/menus/menus-contribution-handler.ts +2 -2
  94. package/src/main/browser/menus/vscode-theia-menu-mappings.ts +2 -1
  95. package/src/main/browser/plugin-contribution-handler.ts +14 -30
  96. package/src/main/browser/plugin-ext-argument-processor.ts +39 -0
  97. package/src/main/browser/plugin-ext-frontend-module.ts +9 -2
  98. package/src/main/browser/preference-registry-main.ts +9 -7
  99. package/src/main/browser/view/plugin-view-registry.ts +3 -0
  100. package/src/main/browser/view/tree-views-main.ts +1 -1
  101. package/src/main/browser/webview/pre/main.js +13 -10
  102. package/src/main/browser/webview/webview-frontend-preference-contribution.ts +37 -0
  103. package/src/main/browser/webview/webview-theme-data-provider.ts +1 -1
  104. package/src/main/browser/webview/webview.ts +1 -1
  105. package/src/main/browser/workspace-main.ts +2 -2
  106. package/src/main/{browser/webview → common}/webview-preferences.ts +3 -16
  107. package/src/main/node/plugin-ext-backend-module.ts +2 -0
  108. package/src/plugin/plugin-context.ts +1 -1
  109. package/src/plugin/status-bar/status-bar-item.ts +54 -0
  110. package/src/plugin/status-bar-message-registry.ts +3 -2
  111. package/lib/main/browser/webview/webview-preferences.d.ts.map +0 -1
  112. package/lib/main/browser/webview/webview-preferences.js.map +0 -1
@@ -68,18 +68,19 @@ import {
68
68
  } from '../../../common/plugin-protocol';
69
69
  import { promises as fs } from 'fs';
70
70
  import * as path from 'path';
71
- import { isObject, isStringArray, RecursivePartial } from '@theia/core/lib/common/types';
71
+ import { isObject, isStringArray } from '@theia/core/lib/common/types';
72
72
  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
76
  import { IJSONSchema } from '@theia/core/lib/common/json-schema';
77
77
  import { deepClone } from '@theia/core/lib/common/objects';
78
- import { PreferenceSchema, PreferenceSchemaProperties } from '@theia/core/lib/common/preferences/preference-schema';
78
+ import { PreferenceSchema, PreferenceDataProperty } from '@theia/core/lib/common/preferences/preference-schema';
79
79
  import { TaskDefinition } from '@theia/task/lib/common/task-protocol';
80
80
  import { ColorDefinition } from '@theia/core/lib/common/color';
81
81
  import { CSSIcon } from '@theia/core/lib/common/markdown-rendering/icon-utilities';
82
82
  import { PluginUriFactory } from './plugin-uri-factory';
83
+ import { PreferenceScope } from '@theia/core/lib/common/preferences/preference-scope';
83
84
 
84
85
  const colorIdPattern = '^\\w+[.\\w+]*$';
85
86
  const iconIdPattern = `^${CSSIcon.iconNameSegment}(-${CSSIcon.iconNameSegment})+$`;
@@ -91,6 +92,52 @@ function getFileExtension(filePath: string): string {
91
92
 
92
93
  type PluginPackageWithContributes = PluginPackage & { contributes: PluginPackageContribution };
93
94
 
95
+ type ScopeString = 'machine-overridable' | 'window' | 'resource' | 'language-overridable' | 'application' | 'machine';
96
+
97
+ type EditPresentationTypes = 'multilineText' | 'singleLineText';
98
+ export interface IConfigurationPropertySchema extends IJSONSchema {
99
+
100
+ scope?: ScopeString;
101
+
102
+ /**
103
+ * When `false` this property is excluded from the registry. Default is to include.
104
+ */
105
+ included?: boolean;
106
+
107
+ /**
108
+ * List of tags associated to the property.
109
+ * - A tag can be used for filtering
110
+ * - Use `experimental` tag for marking the setting as experimental.
111
+ * - Use `onExP` tag for marking that the default of the setting can be changed by running experiments.
112
+ */
113
+ tags?: string[];
114
+
115
+ /**
116
+ * When specified, controls the presentation format of string settings.
117
+ * Otherwise, the presentation format defaults to `singleline`.
118
+ */
119
+ editPresentation?: EditPresentationTypes;
120
+
121
+ /**
122
+ * When specified, gives an order number for the setting
123
+ * within the settings editor. Otherwise, the setting is placed at the end.
124
+ */
125
+ order?: number;
126
+
127
+ }
128
+
129
+ export interface IExtensionInfo {
130
+ id: string;
131
+ displayName?: string;
132
+ }
133
+
134
+ export interface IConfigurationNode {
135
+ title?: string;
136
+ description?: string;
137
+ properties?: Record<string, IConfigurationPropertySchema>;
138
+ scope?: ScopeString;
139
+ }
140
+
94
141
  @injectable()
95
142
  export abstract class AbstractPluginScanner implements PluginScanner {
96
143
 
@@ -191,6 +238,21 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
191
238
  return result;
192
239
  }
193
240
 
241
+ static getScope(monacoScope: string | undefined): { scope: PreferenceScope | undefined, overridable: boolean } {
242
+ switch (monacoScope) {
243
+ case 'machine-overridable':
244
+ case 'window':
245
+ case 'resource':
246
+ return { scope: PreferenceScope.Folder, overridable: false };
247
+ case 'language-overridable':
248
+ return { scope: PreferenceScope.Folder, overridable: true };
249
+ case 'application':
250
+ case 'machine':
251
+ return { scope: PreferenceScope.User, overridable: false };
252
+ }
253
+ return { scope: undefined, overridable: false };
254
+ }
255
+
194
256
  protected override async readContributions(rawPlugin: PluginPackageWithContributes, contributions: PluginContribution): Promise<PluginContribution> {
195
257
  try {
196
258
  if (rawPlugin.contributes.configuration) {
@@ -220,7 +282,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
220
282
  }
221
283
 
222
284
  const configurationDefaults = rawPlugin.contributes.configurationDefaults;
223
- contributions.configurationDefaults = PreferenceSchemaProperties.is(configurationDefaults) ? configurationDefaults : undefined;
285
+ contributions.configurationDefaults = isObject(configurationDefaults) ? configurationDefaults : undefined;
224
286
 
225
287
  try {
226
288
  if (rawPlugin.contributes.submenus) {
@@ -665,8 +727,28 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
665
727
  }
666
728
 
667
729
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
668
- private readConfiguration(rawConfiguration: RecursivePartial<PreferenceSchema>, pluginPath: string): PreferenceSchema | undefined {
669
- return PreferenceSchema.is(rawConfiguration) ? rawConfiguration : undefined;
730
+ private readConfiguration(rawConfiguration: IConfigurationNode, pluginPath: string): PreferenceSchema | undefined {
731
+ const { scope, overridable } = TheiaPluginScanner.getScope(rawConfiguration.scope);
732
+ const schema: PreferenceSchema = {
733
+ scope,
734
+ defaultOverridable: overridable,
735
+ title: rawConfiguration.title,
736
+ properties: {}
737
+ };
738
+
739
+ if (rawConfiguration.properties) {
740
+ for (const [key, property] of Object.entries(rawConfiguration.properties)) {
741
+ const scopeInfo = TheiaPluginScanner.getScope(property.scope);
742
+ const schemaProperty: PreferenceDataProperty = {
743
+ ...property,
744
+ scope: scopeInfo.scope,
745
+ overridable: scopeInfo.overridable
746
+ };
747
+
748
+ schema.properties[key] = schemaProperty;
749
+ }
750
+ }
751
+ return schema;
670
752
  }
671
753
 
672
754
  private readKeybinding(rawKeybinding: PluginPackageKeybinding): Keybinding {
@@ -16,13 +16,13 @@
16
16
 
17
17
  import URI from '@theia/core/lib/common/uri';
18
18
  import {
19
- ApplicationShell, DiffUris, OpenHandler, OpenerOptions, PreferenceService, SplitWidget, Widget, WidgetManager, WidgetOpenerOptions, getDefaultHandler, defaultHandlerPriority
19
+ ApplicationShell, DiffUris, OpenHandler, OpenerOptions, SplitWidget, Widget, WidgetManager, WidgetOpenerOptions, getDefaultHandler, defaultHandlerPriority
20
20
  } from '@theia/core/lib/browser';
21
21
  import { CustomEditor, CustomEditorPriority, CustomEditorSelector } from '../../../common';
22
22
  import { CustomEditorWidget } from './custom-editor-widget';
23
23
  import { PluginCustomEditorRegistry } from './plugin-custom-editor-registry';
24
24
  import { generateUuid } from '@theia/core/lib/common/uuid';
25
- import { DisposableCollection, Emitter } from '@theia/core';
25
+ import { DisposableCollection, Emitter, PreferenceService } from '@theia/core';
26
26
  import { match } from '@theia/core/lib/common/glob';
27
27
 
28
28
  export class CustomEditorOpener implements OpenHandler {
@@ -40,7 +40,7 @@ import { WebviewsMainImpl } from '../webviews-main';
40
40
  import { WidgetManager } from '@theia/core/lib/browser/widget-manager';
41
41
  import { ApplicationShell, LabelProvider, Saveable, SaveAsOptions, SaveOptions } from '@theia/core/lib/browser';
42
42
  import { WebviewPanelOptions } from '@theia/plugin';
43
- import { EditorPreferences } from '@theia/editor/lib/browser';
43
+ import { EditorPreferences } from '@theia/editor/lib/common/editor-preferences';
44
44
  import { BinaryBuffer } from '@theia/core/lib/common/buffer';
45
45
 
46
46
  const enum CustomEditorModelType {
@@ -19,8 +19,8 @@ import { CustomEditor, DeployedPlugin } from '../../../common';
19
19
  import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
20
20
  import { Deferred } from '@theia/core/lib/common/promise-util';
21
21
  import { CustomEditorOpener } from './custom-editor-opener';
22
- import { Emitter } from '@theia/core';
23
- import { ApplicationShell, DefaultOpenerService, OpenWithService, PreferenceService, WidgetManager } from '@theia/core/lib/browser';
22
+ import { Emitter, PreferenceService } from '@theia/core';
23
+ import { ApplicationShell, DefaultOpenerService, OpenWithService, WidgetManager } from '@theia/core/lib/browser';
24
24
  import { CustomEditorWidget } from './custom-editor-widget';
25
25
 
26
26
  @injectable()
@@ -39,7 +39,7 @@ import { DebugConfigurationManager } from '@theia/debug/lib/browser/debug-config
39
39
  import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
40
40
  import { MessageClient } from '@theia/core/lib/common/message-service-protocol';
41
41
  import { OutputChannelManager } from '@theia/output/lib/browser/output-channel';
42
- import { DebugPreferences } from '@theia/debug/lib/browser/debug-preferences';
42
+ import { DebugPreferences } from '@theia/debug/lib/common/debug-preferences';
43
43
  import { PluginDebugAdapterContribution } from './plugin-debug-adapter-contribution';
44
44
  import { PluginDebugConfigurationProvider } from './plugin-debug-configuration-provider';
45
45
  import { PluginDebugSessionContributionRegistrator, PluginDebugSessionContributionRegistry } from './plugin-debug-session-contribution-registry';
@@ -21,7 +21,7 @@ import { BreakpointManager } from '@theia/debug/lib/browser/breakpoint/breakpoin
21
21
  import { LabelProvider } from '@theia/core/lib/browser/label-provider';
22
22
  import { MessageClient } from '@theia/core/lib/common/message-service-protocol';
23
23
  import { OutputChannelManager } from '@theia/output/lib/browser/output-channel';
24
- import { DebugPreferences } from '@theia/debug/lib/browser/debug-preferences';
24
+ import { DebugPreferences } from '@theia/debug/lib/common/debug-preferences';
25
25
  import { DebugConfigurationSessionOptions, TestRunReference } from '@theia/debug/lib/browser/debug-session-options';
26
26
  import { DebugSession } from '@theia/debug/lib/browser/debug-session';
27
27
  import { DebugSessionConnection } from '@theia/debug/lib/browser/debug-session-connection';
@@ -22,7 +22,7 @@ import { MenuModelRegistry } from '@theia/core/lib/common';
22
22
  import { TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
23
23
  import { DeployedPlugin, IconUrl, Menu } from '../../../common';
24
24
  import { ScmWidget } from '@theia/scm/lib/browser/scm-widget';
25
- import { KeybindingRegistry, QuickCommandService } from '@theia/core/lib/browser';
25
+ import { KeybindingRegistry, QuickCommandService, codicon } from '@theia/core/lib/browser';
26
26
  import {
27
27
  CodeEditorWidgetUtil, codeToTheiaMappings, ContributionPoint,
28
28
  PLUGIN_EDITOR_TITLE_MENU, PLUGIN_EDITOR_TITLE_RUN_MENU, PLUGIN_SCM_TITLE_MENU, PLUGIN_VIEW_TITLE_MENU
@@ -54,7 +54,7 @@ export class MenusContributionPointHandler {
54
54
  this.tabBarToolbar.registerItem({
55
55
  id: this.tabBarToolbar.toElementId(PLUGIN_EDITOR_TITLE_RUN_MENU),
56
56
  menuPath: PLUGIN_EDITOR_TITLE_RUN_MENU,
57
- icon: 'debug-alt',
57
+ icon: codicon('debug-alt'),
58
58
  text: nls.localizeByDefault('Run or Debug...'),
59
59
  command: '',
60
60
  group: 'navigation',
@@ -15,7 +15,7 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { MenuPath } from '@theia/core';
18
- import { SHELL_TABBAR_CONTEXT_MENU } from '@theia/core/lib/browser';
18
+ import { CommonMenus, SHELL_TABBAR_CONTEXT_MENU } from '@theia/core/lib/browser';
19
19
  import { Navigatable } from '@theia/core/lib/browser/navigatable';
20
20
  import { URI as CodeUri } from '@theia/core/shared/vscode-uri';
21
21
  import { DebugStackFramesWidget } from '@theia/debug/lib/browser/view/debug-stack-frames-widget';
@@ -88,6 +88,7 @@ export const codeToTheiaMappings = new Map<string, MenuPath[]>([
88
88
  ['editor/title/run', [PLUGIN_EDITOR_TITLE_RUN_MENU]],
89
89
  ['editor/lineNumber/context', [EDITOR_LINENUMBER_CONTEXT_MENU]],
90
90
  ['explorer/context', [NAVIGATOR_CONTEXT_MENU]],
91
+ ['file/newFile', [CommonMenus.FILE_NEW_CONTRIBUTIONS]],
91
92
  ['scm/change/title', [PLUGIN_SCM_CHANGE_TITLE_MENU]],
92
93
  ['scm/resourceFolder/context', [ScmTreeWidget.RESOURCE_FOLDER_CONTEXT_MENU]],
93
94
  ['scm/resourceGroup/context', [ScmTreeWidget.RESOURCE_GROUP_CONTEXT_MENU]],
@@ -27,9 +27,7 @@ import {
27
27
  import {
28
28
  DefaultUriLabelProviderContribution,
29
29
  LabelProviderContribution,
30
- PreferenceSchemaProvider
31
30
  } from '@theia/core/lib/browser';
32
- import { DefaultOverridesPreferenceSchemaId, PreferenceLanguageOverrideService, PreferenceSchema, PreferenceSchemaProperties } from '@theia/core/lib/browser/preferences';
33
31
  import { KeybindingsContributionPointHandler } from './keybindings/keybindings-contribution-handler';
34
32
  import { MonacoSnippetSuggestProvider } from '@theia/monaco/lib/browser/monaco-snippet-suggest-provider';
35
33
  import { PluginSharedStyle } from './plugin-shared-style';
@@ -44,7 +42,7 @@ import { MonacoThemingService } from '@theia/monaco/lib/browser/monaco-theming-s
44
42
  import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
45
43
  import { PluginIconService } from './plugin-icon-service';
46
44
  import { PluginIconThemeService } from './plugin-icon-theme-service';
47
- import { ContributionProvider } from '@theia/core/lib/common';
45
+ import { ContributionProvider, isObject, OVERRIDE_PROPERTY_PATTERN, PreferenceSchemaService } from '@theia/core/lib/common';
48
46
  import * as monaco from '@theia/monaco-editor-core';
49
47
  import { ContributedTerminalProfileStore, TerminalProfileStore } from '@theia/terminal/lib/browser/terminal-profile-service';
50
48
  import { TerminalWidget } from '@theia/terminal/lib/browser/base/terminal-widget';
@@ -53,6 +51,7 @@ import { PluginTerminalRegistry } from './plugin-terminal-registry';
53
51
  import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
54
52
  import { LanguageService } from '@theia/core/lib/browser/language-service';
55
53
  import { ThemeIcon } from '@theia/monaco-editor-core/esm/vs/base/common/themables';
54
+ import { JSONObject, JSONValue } from '@theia/core/shared/@lumino/coreutils';
56
55
 
57
56
  // The enum export is missing from `vscode-textmate@9.2.0`
58
57
  const enum StandardTokenType {
@@ -79,11 +78,8 @@ export class PluginContributionHandler {
79
78
  @inject(MenusContributionPointHandler)
80
79
  private readonly menusContributionHandler: MenusContributionPointHandler;
81
80
 
82
- @inject(PreferenceSchemaProvider)
83
- private readonly preferenceSchemaProvider: PreferenceSchemaProvider;
84
-
85
- @inject(PreferenceLanguageOverrideService)
86
- private readonly preferenceOverrideService: PreferenceLanguageOverrideService;
81
+ @inject(PreferenceSchemaService)
82
+ private readonly preferenceSchemaProvider: PreferenceSchemaService;
87
83
 
88
84
  @inject(MonacoTextmateService)
89
85
  private readonly monacoTextmateService: MonacoTextmateService;
@@ -184,7 +180,7 @@ export class PluginContributionHandler {
184
180
  const configuration = contributions.configuration;
185
181
  if (configuration) {
186
182
  for (const config of configuration) {
187
- pushContribution('configuration', () => this.preferenceSchemaProvider.setSchema(config));
183
+ pushContribution('configuration', () => this.preferenceSchemaProvider.addSchema(config));
188
184
  }
189
185
  }
190
186
 
@@ -552,34 +548,22 @@ export class PluginContributionHandler {
552
548
  return !!this.commandHandlers.get(id);
553
549
  }
554
550
 
555
- protected updateDefaultOverridesSchema(configurationDefaults: PreferenceSchemaProperties): Disposable {
556
- const defaultOverrides: PreferenceSchema = {
557
- id: DefaultOverridesPreferenceSchemaId,
558
- title: 'Default Configuration Overrides',
559
- properties: {}
560
- };
551
+ protected updateDefaultOverridesSchema(configurationDefaults: JSONObject): Disposable {
552
+ const disposables = new DisposableCollection();
561
553
  // eslint-disable-next-line guard-for-in
562
554
  for (const key in configurationDefaults) {
563
555
  const defaultValue = configurationDefaults[key];
564
- if (this.preferenceOverrideService.testOverrideValue(key, defaultValue)) {
565
- // language specific override
566
- defaultOverrides.properties[key] = {
567
- type: 'object',
568
- default: defaultValue,
569
- description: `Configure editor settings to be overridden for ${key} language.`
570
- };
556
+ const match = key.match(OVERRIDE_PROPERTY_PATTERN);
557
+ if (match && isObject(defaultValue)) {
558
+ for (const [propertyName, value] of Object.entries(defaultValue)) {
559
+ disposables.push(this.preferenceSchemaProvider.registerOverride(propertyName, match[1], value as JSONValue));
560
+ }
571
561
  } else {
572
562
  // regular configuration override
573
- defaultOverrides.properties[key] = {
574
- default: defaultValue,
575
- description: `Configure default setting for ${key}.`
576
- };
563
+ disposables.push(this.preferenceSchemaProvider.registerOverride(key, undefined, defaultValue));
577
564
  }
578
565
  }
579
- if (Object.keys(defaultOverrides.properties).length) {
580
- return this.preferenceSchemaProvider.setSchema(defaultOverrides);
581
- }
582
- return Disposable.NULL;
566
+ return disposables;
583
567
  }
584
568
 
585
569
  private createRegex(value: string | RegExpOptions | undefined): RegExp | undefined {
@@ -0,0 +1,39 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2025 EclipseSource GmbH.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { Widget } from '@theia/core/lib/browser';
18
+ import { injectable } from '@theia/core/shared/inversify';
19
+ import { ArgumentProcessor } from '../../common/commands';
20
+
21
+ /**
22
+ * This processor handles arguments passed to commands that are contributed by plugins and available as toolbar items.
23
+ *
24
+ * When a toolbar item executes a command, it often passes the active widget as an argument. This can lead to
25
+ * serialization problems. To solve this issue, this processor checks if an argument is a Widget instance and if so, it extracts
26
+ * and returns only the widget's ID, which can be safely serialized and used to identify the widget in the plugin host.
27
+ */
28
+ @injectable()
29
+ export class PluginExtToolbarItemArgumentProcessor implements ArgumentProcessor {
30
+
31
+ processArgument(arg: unknown): unknown {
32
+ if (arg instanceof Widget) {
33
+ return arg.id;
34
+ }
35
+
36
+ return arg;
37
+ }
38
+
39
+ }
@@ -26,7 +26,7 @@ import {
26
26
  noopWidgetStatusBarContribution,
27
27
  WidgetStatusBarContribution
28
28
  } from '@theia/core/lib/browser';
29
- import { MaybePromise, CommandContribution, ResourceResolver, bindContributionProvider, URI, generateUuid } from '@theia/core/lib/common';
29
+ import { MaybePromise, CommandContribution, ResourceResolver, bindContributionProvider, URI, generateUuid, PreferenceContribution } from '@theia/core/lib/common';
30
30
  import { WebSocketConnectionProvider } from '@theia/core/lib/browser/messaging';
31
31
  import { HostedPluginSupport } from '../../hosted/browser/hosted-plugin';
32
32
  import { HostedPluginWatcher } from '../../hosted/browser/hosted-plugin-watcher';
@@ -60,7 +60,6 @@ import { OutputChannelRegistryMainImpl } from './output-channel-registry-main';
60
60
  import { WebviewWidget } from './webview/webview';
61
61
  import { WebviewEnvironment } from './webview/webview-environment';
62
62
  import { WebviewThemeDataProvider } from './webview/webview-theme-data-provider';
63
- import { bindWebviewPreferences } from './webview/webview-preferences';
64
63
  import { WebviewResourceCache } from './webview/webview-resource-cache';
65
64
  import { PluginIconThemeService, PluginIconThemeFactory, PluginIconThemeDefinition, PluginIconTheme } from './plugin-icon-theme-service';
66
65
  import { PluginTreeViewNodeLabelProvider } from './view/plugin-tree-view-node-label-provider';
@@ -90,6 +89,9 @@ import { CellOutputWebviewImpl, createCellOutputWebviewContainer } from './noteb
90
89
  import { ArgumentProcessorContribution } from './command-registry-main';
91
90
  import { WebviewSecondaryWindowSupport } from './webview/webview-secondary-window-support';
92
91
  import { CustomEditorUndoRedoHandler } from './custom-editors/custom-editor-undo-redo-handler';
92
+ import { bindWebviewPreferences } from '../common/webview-preferences';
93
+ import { WebviewFrontendPreferenceContribution } from './webview/webview-frontend-preference-contribution';
94
+ import { PluginExtToolbarItemArgumentProcessor } from './plugin-ext-argument-processor';
93
95
 
94
96
  export default new ContainerModule((bind, unbind, isBound, rebind) => {
95
97
 
@@ -180,6 +182,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
180
182
  })).inSingletonScope();
181
183
 
182
184
  bindWebviewPreferences(bind);
185
+ bind(WebviewFrontendPreferenceContribution).toSelf().inSingletonScope();
186
+ bind(PreferenceContribution).toService(WebviewFrontendPreferenceContribution);
183
187
  bind(WebviewEnvironment).toSelf().inSingletonScope();
184
188
  bind(WebviewThemeDataProvider).toSelf().inSingletonScope();
185
189
  bind(WebviewResourceCache).toSelf().inSingletonScope();
@@ -287,4 +291,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
287
291
  );
288
292
  bindContributionProvider(bind, ArgumentProcessorContribution);
289
293
 
294
+ bind(PluginExtToolbarItemArgumentProcessor).toSelf().inSingletonScope();
295
+ bind(ArgumentProcessorContribution).toService(PluginExtToolbarItemArgumentProcessor);
296
+
290
297
  });
@@ -19,7 +19,7 @@ import {
19
19
  PreferenceServiceImpl,
20
20
  PreferenceScope,
21
21
  PreferenceProviderProvider
22
- } from '@theia/core/lib/browser/preferences';
22
+ } from '@theia/core/lib/common/preferences';
23
23
  import { interfaces } from '@theia/core/shared/inversify';
24
24
  import {
25
25
  MAIN_RPC_CONTEXT,
@@ -40,13 +40,15 @@ export function getPreferences(preferenceProviderProvider: PreferenceProviderPro
40
40
  return PreferenceScope.getScopes().reduce((result: { [key: number]: any }, scope: PreferenceScope) => {
41
41
  result[scope] = {};
42
42
  const provider = preferenceProviderProvider(scope);
43
- if (scope === PreferenceScope.Folder) {
44
- for (const f of folders) {
45
- const folderPrefs = provider.getPreferences(f);
46
- result[scope][f] = folderPrefs;
43
+ if (provider) {
44
+ if (scope === PreferenceScope.Folder) {
45
+ for (const f of folders) {
46
+ const folderPrefs = provider.getPreferences(f);
47
+ result[scope][f] = folderPrefs;
48
+ }
49
+ } else {
50
+ result[scope] = provider.getPreferences();
47
51
  }
48
- } else {
49
- result[scope] = provider.getPreferences();
50
52
  }
51
53
  return result;
52
54
  }, {} as PreferenceData);
@@ -426,6 +426,9 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
426
426
  toDispose.push(this.commands.registerCommand({ id: `${view.id}.focus` }, {
427
427
  execute: async () => { await this.openView(view.id, { activate: true }); }
428
428
  }));
429
+ toDispose.push(this.commands.registerCommand({ id: `${view.id}.open` }, {
430
+ execute: async () => { await this.openView(view.id, { activate: true }); }
431
+ }));
429
432
  return toDispose;
430
433
  }
431
434
 
@@ -90,7 +90,7 @@ export class TreeViewsMainImpl implements TreeViewsMain, Disposable {
90
90
  this.toDispose.push(Disposable.create(() => widget.model.proxy = undefined));
91
91
  this.handleTreeEvents(widget.id, widget);
92
92
  }
93
- await widget.model.refresh();
93
+ widget.model.refresh();
94
94
  return widget;
95
95
  }));
96
96
  this.toDispose.push(Disposable.create(() => this.$unregisterTreeDataProvider(treeViewId)));
@@ -250,9 +250,11 @@ delete window.frameElement;
250
250
  }
251
251
 
252
252
  let baseElement = event.view.document.getElementsByTagName('base')[0];
253
- /** @type {any} */
254
- let node = event.target;
255
- while (node) {
253
+
254
+ // Use composedPath to get the event path through shadow DOM
255
+ const path = event.composedPath ? event.composedPath() : [event.target];
256
+
257
+ for (const node of path) {
256
258
  if (node.tagName && node.tagName.toLowerCase() === 'a' && node.href) {
257
259
  if (node.getAttribute('href') === '#') {
258
260
  event.view.scrollTo(0, 0);
@@ -267,7 +269,6 @@ delete window.frameElement;
267
269
  event.preventDefault();
268
270
  break;
269
271
  }
270
- node = node.parentNode;
271
272
  }
272
273
  };
273
274
 
@@ -282,13 +283,14 @@ delete window.frameElement;
282
283
  }
283
284
 
284
285
  if (event.button === 1) {
285
- let node = /** @type {any} */ (event.target);
286
- while (node) {
286
+ // Use composedPath to get the event path through shadow DOM
287
+ const path = event.composedPath ? event.composedPath() : [event.target];
288
+
289
+ for (const node of path) {
287
290
  if (node.tagName && node.tagName.toLowerCase() === 'a' && node.href) {
288
291
  event.preventDefault();
289
292
  break;
290
293
  }
291
- node = node.parentNode;
292
294
  }
293
295
  }
294
296
  };
@@ -354,16 +356,17 @@ delete window.frameElement;
354
356
  host.postMessage('did-context-menu', {
355
357
  clientX: e.clientX,
356
358
  clientY: e.clientY,
357
- context: findVscodeContext(e.target)
359
+ context: findVscodeContext(e.composedPath(), 0)
358
360
  });
359
361
  };
360
362
 
361
- function findVscodeContext(node) {
363
+ function findVscodeContext(nodes, index) {
364
+ const node = nodes[index];
362
365
  if (node) {
363
366
  if (node.dataset?.vscodeContext) {
364
367
  return JSON.parse(node.dataset.vscodeContext);
365
368
  }
366
- return findVscodeContext(node.parentElement);
369
+ return findVscodeContext(nodes, ++index);
367
370
  }
368
371
  return {};
369
372
  }
@@ -0,0 +1,37 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2025 STMicroelectronics and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ import { nls, PreferenceContribution, PreferenceSchema, PreferenceSchemaService, PreferenceScope } from '@theia/core';
16
+ import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
17
+
18
+ const schema: PreferenceSchema = {
19
+ properties: {
20
+ 'webview.warnIfUnsecure': {
21
+ scope: PreferenceScope.Default,
22
+ type: 'boolean',
23
+ description: nls.localize('theia/plugin-ext/webviewWarnIfUnsecure', 'Warns users that webviews are currently deployed insecurely.'),
24
+ default: true,
25
+
26
+ }
27
+ }
28
+ };
29
+
30
+ export class WebviewFrontendPreferenceContribution implements PreferenceContribution {
31
+ async initSchema(service: PreferenceSchemaService): Promise<void> {
32
+ const frontendConfig = FrontendApplicationConfigProvider.get();
33
+ if (frontendConfig.securityWarnings) {
34
+ service.addSchema(schema);
35
+ }
36
+ }
37
+ };
@@ -21,7 +21,7 @@
21
21
 
22
22
  import { inject, postConstruct, injectable } from '@theia/core/shared/inversify';
23
23
  import { Emitter } from '@theia/core/lib/common/event';
24
- import { EditorPreferences, EditorConfiguration } from '@theia/editor/lib/browser/editor-preferences';
24
+ import { EditorPreferences, EditorConfiguration } from '@theia/editor/lib/common/editor-preferences';
25
25
  import { ThemeService } from '@theia/core/lib/browser/theming';
26
26
  import { Theme } from '@theia/core/lib/common/theme';
27
27
  import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
@@ -41,7 +41,6 @@ import { PluginSharedStyle } from '../plugin-shared-style';
41
41
  import { WebviewThemeDataProvider } from './webview-theme-data-provider';
42
42
  import { ExternalUriService } from '@theia/core/lib/browser/external-uri-service';
43
43
  import { OutputChannelManager } from '@theia/output/lib/browser/output-channel';
44
- import { WebviewPreferences } from './webview-preferences';
45
44
  import { WebviewResourceCache } from './webview-resource-cache';
46
45
  import { Endpoint } from '@theia/core/lib/browser/endpoint';
47
46
  import { isFirefox } from '@theia/core/lib/browser/browser';
@@ -54,6 +53,7 @@ import { MenuPath } from '@theia/core';
54
53
  import { ContextMenuRenderer } from '@theia/core/lib/browser';
55
54
  import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
56
55
  import { PluginViewWidget } from '../view/plugin-view-widget';
56
+ import { WebviewPreferences } from '../../common/webview-preferences';
57
57
 
58
58
  // Style from core
59
59
  const TRANSPARENT_OVERLAY_STYLE = 'theia-transparent-overlay';
@@ -31,14 +31,14 @@ import { Resource } from '@theia/core/lib/common/resource';
31
31
  import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
32
32
  import { Emitter, Event, ResourceResolver, CancellationToken, isUndefined } from '@theia/core';
33
33
  import { PluginServer } from '../../common/plugin-protocol';
34
- import { FileSystemPreferences } from '@theia/filesystem/lib/browser';
34
+ import { FileSystemPreferences } from '@theia/filesystem/lib/common';
35
35
  import { SearchInWorkspaceService } from '@theia/search-in-workspace/lib/browser/search-in-workspace-service';
36
36
  import { FileStat } from '@theia/filesystem/lib/common/files';
37
37
  import { MonacoQuickInputService } from '@theia/monaco/lib/browser/monaco-quick-input-service';
38
38
  import { RequestService } from '@theia/core/shared/@theia/request';
39
39
  import { UTF16be, UTF16le, UTF8, UTF8_with_bom } from '@theia/core/lib/common/encodings';
40
40
  import { EncodingRegistry } from '@theia/core/lib/browser/encoding-registry';
41
- import { PreferenceService } from '@theia/core/lib/browser/preferences/preference-service';
41
+ import { PreferenceService } from '@theia/core/lib/common/preferences/preference-service';
42
42
 
43
43
  export class WorkspaceMainImpl implements WorkspaceMain, Disposable {
44
44