@theia/plugin-ext 1.29.0-next.6 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/lib/common/plugin-api-rpc-model.d.ts +7 -0
  2. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  3. package/lib/common/plugin-api-rpc-model.js.map +1 -1
  4. package/lib/common/plugin-api-rpc.d.ts +16 -16
  5. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  6. package/lib/common/plugin-api-rpc.js.map +1 -1
  7. package/lib/common/rpc-protocol.d.ts +1 -1
  8. package/lib/common/rpc-protocol.d.ts.map +1 -1
  9. package/lib/common/rpc-protocol.js +3 -3
  10. package/lib/common/rpc-protocol.js.map +1 -1
  11. package/lib/main/browser/authentication-main.d.ts +3 -6
  12. package/lib/main/browser/authentication-main.d.ts.map +1 -1
  13. package/lib/main/browser/authentication-main.js +16 -37
  14. package/lib/main/browser/authentication-main.js.map +1 -1
  15. package/lib/main/browser/comments/comment-thread-widget.d.ts +2 -0
  16. package/lib/main/browser/comments/comment-thread-widget.d.ts.map +1 -1
  17. package/lib/main/browser/comments/comment-thread-widget.js +4 -3
  18. package/lib/main/browser/comments/comment-thread-widget.js.map +1 -1
  19. package/lib/main/browser/debug/debug-main.d.ts +1 -1
  20. package/lib/main/browser/debug/debug-main.d.ts.map +1 -1
  21. package/lib/main/browser/debug/debug-main.js +20 -10
  22. package/lib/main/browser/debug/debug-main.js.map +1 -1
  23. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +4 -4
  24. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  25. package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
  26. package/lib/main/browser/languages-main.d.ts +6 -1
  27. package/lib/main/browser/languages-main.d.ts.map +1 -1
  28. package/lib/main/browser/languages-main.js +15 -1
  29. package/lib/main/browser/languages-main.js.map +1 -1
  30. package/lib/main/browser/plugin-ext-frontend-module.d.ts +1 -0
  31. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  32. package/lib/main/browser/plugin-ext-frontend-module.js +1 -0
  33. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  34. package/lib/main/browser/theme-icon-override.d.ts +2 -0
  35. package/lib/main/browser/theme-icon-override.d.ts.map +1 -0
  36. package/lib/main/browser/theme-icon-override.js +217 -0
  37. package/lib/main/browser/theme-icon-override.js.map +1 -0
  38. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  39. package/lib/main/browser/view/plugin-view-registry.js +0 -1
  40. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  41. package/lib/main/browser/view/plugin-view-widget.d.ts +9 -8
  42. package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
  43. package/lib/main/browser/view/plugin-view-widget.js +7 -4
  44. package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
  45. package/lib/main/browser/view/tree-view-decorator-service.d.ts +1 -1
  46. package/lib/main/browser/view/tree-view-decorator-service.d.ts.map +1 -1
  47. package/lib/main/browser/view/tree-view-decorator-service.js +1 -1
  48. package/lib/main/browser/view/tree-view-decorator-service.js.map +1 -1
  49. package/lib/main/node/plugin-ext-backend-module.d.ts +1 -1
  50. package/lib/main/node/plugin-ext-backend-module.d.ts.map +1 -1
  51. package/lib/main/node/plugin-ext-backend-module.js +4 -1
  52. package/lib/main/node/plugin-ext-backend-module.js.map +1 -1
  53. package/lib/main/node/plugin-localization-backend-contribution.d.ts +10 -0
  54. package/lib/main/node/plugin-localization-backend-contribution.d.ts.map +1 -0
  55. package/lib/main/node/plugin-localization-backend-contribution.js +59 -0
  56. package/lib/main/node/plugin-localization-backend-contribution.js.map +1 -0
  57. package/lib/plugin/authentication-ext.d.ts +1 -11
  58. package/lib/plugin/authentication-ext.d.ts.map +1 -1
  59. package/lib/plugin/authentication-ext.js +3 -55
  60. package/lib/plugin/authentication-ext.js.map +1 -1
  61. package/lib/plugin/languages/code-action.d.ts.map +1 -1
  62. package/lib/plugin/languages/code-action.js +8 -9
  63. package/lib/plugin/languages/code-action.js.map +1 -1
  64. package/lib/plugin/languages/document-highlight.d.ts.map +1 -1
  65. package/lib/plugin/languages/document-highlight.js +0 -1
  66. package/lib/plugin/languages/document-highlight.js.map +1 -1
  67. package/lib/plugin/languages/evaluatable-expression.d.ts +12 -0
  68. package/lib/plugin/languages/evaluatable-expression.d.ts.map +1 -0
  69. package/lib/plugin/languages/evaluatable-expression.js +41 -0
  70. package/lib/plugin/languages/evaluatable-expression.js.map +1 -0
  71. package/lib/plugin/languages/util.d.ts +2 -2
  72. package/lib/plugin/languages/util.d.ts.map +1 -1
  73. package/lib/plugin/languages/util.js +0 -2
  74. package/lib/plugin/languages/util.js.map +1 -1
  75. package/lib/plugin/languages.d.ts +3 -1
  76. package/lib/plugin/languages.d.ts.map +1 -1
  77. package/lib/plugin/languages.js +11 -0
  78. package/lib/plugin/languages.js.map +1 -1
  79. package/lib/plugin/plugin-context.d.ts.map +1 -1
  80. package/lib/plugin/plugin-context.js +7 -35
  81. package/lib/plugin/plugin-context.js.map +1 -1
  82. package/lib/plugin/plugin-storage.d.ts +1 -0
  83. package/lib/plugin/plugin-storage.d.ts.map +1 -1
  84. package/lib/plugin/plugin-storage.js +3 -0
  85. package/lib/plugin/plugin-storage.js.map +1 -1
  86. package/lib/plugin/preference-registry.d.ts.map +1 -1
  87. package/lib/plugin/preference-registry.js +5 -0
  88. package/lib/plugin/preference-registry.js.map +1 -1
  89. package/lib/plugin/preference-registry.spec.js +44 -1
  90. package/lib/plugin/preference-registry.spec.js.map +1 -1
  91. package/lib/plugin/quick-open.d.ts +5 -1
  92. package/lib/plugin/quick-open.d.ts.map +1 -1
  93. package/lib/plugin/quick-open.js +27 -4
  94. package/lib/plugin/quick-open.js.map +1 -1
  95. package/lib/plugin/type-converters.d.ts +7 -6
  96. package/lib/plugin/type-converters.d.ts.map +1 -1
  97. package/lib/plugin/type-converters.js +54 -55
  98. package/lib/plugin/type-converters.js.map +1 -1
  99. package/lib/plugin/types-impl.d.ts +13 -3
  100. package/lib/plugin/types-impl.d.ts.map +1 -1
  101. package/lib/plugin/types-impl.js +28 -10
  102. package/lib/plugin/types-impl.js.map +1 -1
  103. package/lib/plugin/workspace.d.ts.map +1 -1
  104. package/lib/plugin/workspace.js +6 -1
  105. package/lib/plugin/workspace.js.map +1 -1
  106. package/lib/plugin-ext-backend-electron-module.js +2 -2
  107. package/lib/plugin-ext-backend-electron-module.js.map +1 -1
  108. package/lib/plugin-ext-backend-module.js +2 -2
  109. package/lib/plugin-ext-backend-module.js.map +1 -1
  110. package/package.json +26 -26
  111. package/src/common/plugin-api-rpc-model.ts +10 -0
  112. package/src/common/plugin-api-rpc.ts +13 -15
  113. package/src/common/rpc-protocol.ts +5 -5
  114. package/src/main/browser/authentication-main.ts +17 -42
  115. package/src/main/browser/comments/comment-thread-widget.tsx +5 -3
  116. package/src/main/browser/debug/debug-main.ts +20 -12
  117. package/src/main/browser/debug/plugin-debug-session-factory.ts +3 -3
  118. package/src/main/browser/languages-main.ts +23 -1
  119. package/src/main/browser/plugin-ext-frontend-module.ts +1 -0
  120. package/src/main/browser/style/tree.css +2 -0
  121. package/src/main/browser/theme-icon-override.ts +221 -0
  122. package/src/main/browser/view/plugin-view-registry.ts +0 -1
  123. package/src/main/browser/view/plugin-view-widget.ts +14 -11
  124. package/src/main/browser/view/tree-view-decorator-service.ts +2 -2
  125. package/src/main/node/plugin-ext-backend-module.ts +6 -1
  126. package/src/main/node/plugin-localization-backend-contribution.ts +42 -0
  127. package/src/plugin/authentication-ext.ts +3 -70
  128. package/src/plugin/debug/debug-ext.ts +1 -1
  129. package/src/plugin/languages/code-action.ts +9 -12
  130. package/src/plugin/languages/document-highlight.ts +1 -2
  131. package/src/plugin/languages/evaluatable-expression.ts +47 -0
  132. package/src/plugin/languages/util.ts +2 -4
  133. package/src/plugin/languages.ts +15 -0
  134. package/src/plugin/plugin-context.ts +12 -41
  135. package/src/plugin/plugin-storage.ts +4 -0
  136. package/src/plugin/preference-registry.spec.ts +45 -1
  137. package/src/plugin/preference-registry.ts +5 -0
  138. package/src/plugin/quick-open.ts +32 -6
  139. package/src/plugin/type-converters.ts +58 -59
  140. package/src/plugin/types-impl.ts +36 -14
  141. package/src/plugin/workspace.ts +5 -1
  142. package/src/plugin-ext-backend-electron-module.ts +2 -2
  143. package/src/plugin-ext-backend-module.ts +2 -2
@@ -0,0 +1,221 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2022 TypeFox 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 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { ThemeIcon } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService';
18
+
19
+ // @monaco-uplift
20
+ // Keep this up-to-date with the table at https://code.visualstudio.com/api/references/icons-in-labels#icon-listing
21
+ const codeIconMap: Record<string, string> = {
22
+ 'accounts-view-bar-icon': 'account',
23
+ 'breakpoints-activate': 'activate-breakpoints',
24
+ 'breakpoints-remove-all': 'close-all',
25
+ 'breakpoints-view-icon': 'debug-alt',
26
+ 'callhierarchy-incoming': 'call-incoming',
27
+ 'callhierarchy-outgoing': 'call-outgoing',
28
+ 'callstack-view-icon': 'debug-alt',
29
+ 'callstack-view-session': 'bug',
30
+ 'comments-view-icon': 'comment-discussion',
31
+ 'debug-collapse-all': 'collapse-all',
32
+ 'debug-configure': 'gear',
33
+ 'debug-console-clear-all': 'clear-all',
34
+ 'debug-console-evaluation-input': 'arrow-small-right',
35
+ 'debug-console-evaluation-prompt': 'chevron-right',
36
+ 'debug-console-view-icon': 'debug-console',
37
+ 'debug-gripper': 'gripper',
38
+ 'default-view-icon': 'window',
39
+ 'diff-editor-next-change': 'arrow-down',
40
+ 'diff-editor-previous-change': 'arrow-up',
41
+ 'diff-editor-toggle-whitespace': 'whitespace',
42
+ 'diff-insert': 'add',
43
+ 'diff-remove': 'remove',
44
+ 'diff-review-close': 'close',
45
+ 'diff-review-insert': 'add',
46
+ 'diff-review-remove': 'remove',
47
+ 'explorer-view-icon': 'files',
48
+ 'extensions-clear-search-results': 'clear-all',
49
+ 'extensions-configure-recommended': 'pencil',
50
+ 'extensions-filter': 'filter',
51
+ 'extensions-info-message': 'info',
52
+ 'extensions-install-count': 'cloud-download',
53
+ 'extensions-install-local-in-remote': 'cloud-download',
54
+ 'extensions-install-workspace-recommended': 'cloud-download',
55
+ 'extensions-manage': 'gear',
56
+ 'extensions-rating': 'star',
57
+ 'extensions-refresh': 'refresh',
58
+ 'extensions-remote': 'remote',
59
+ 'extensions-star-empty': 'star-empty',
60
+ 'extensions-star-full': 'star-full',
61
+ 'extensions-star-half': 'star-half',
62
+ 'extensions-sync-enabled': 'sync',
63
+ 'extensions-sync-ignored': 'sync-ignored',
64
+ 'extensions-view-icon': 'extensions',
65
+ 'extensions-warning-message': 'warning',
66
+ 'find-collapsed': 'chevron-right',
67
+ 'find-expanded': 'chevron-down',
68
+ 'find-next-match': 'arrow-down',
69
+ 'find-previous-match': 'arrow-up',
70
+ 'find-replace': 'replace',
71
+ 'find-replace-all': 'replace-all',
72
+ 'find-selection': 'selection',
73
+ 'folding-collapsed': 'chevron-right',
74
+ 'folding-expanded': 'chevron-down',
75
+ 'getting-started-beginner': 'lightbulb',
76
+ 'getting-started-codespaces': 'github',
77
+ 'getting-started-item-checked': 'pass-filled',
78
+ 'getting-started-item-unchecked': 'circle-large-outline',
79
+ 'getting-started-setup': 'heart',
80
+ 'goto-next-location': 'arrow-down',
81
+ 'goto-previous-location': 'arrow-up',
82
+ 'keybindings-add': 'add',
83
+ 'keybindings-edit': 'edit',
84
+ 'keybindings-record-keys': 'record-keys',
85
+ 'keybindings-sort': 'sort-precedence',
86
+ 'loaded-scripts-view-icon': 'debug-alt',
87
+ 'marker-navigation-next': 'chevron-down',
88
+ 'marker-navigation-previous': 'chevron-up',
89
+ 'markers-view-filter': 'filter',
90
+ 'markers-view-icon': 'warning',
91
+ 'markers-view-multi-line-collapsed': 'chevron-down',
92
+ 'markers-view-multi-line-expanded': 'chevron-up',
93
+ 'notebook-clear': 'clear-all',
94
+ 'notebook-collapsed': 'chevron-right',
95
+ 'notebook-delete-cell': 'trash',
96
+ 'notebook-edit': 'pencil',
97
+ 'notebook-execute': 'play',
98
+ 'notebook-execute-all': 'run-all',
99
+ 'notebook-expanded': 'chevron-down',
100
+ 'notebook-kernel-configure': 'settings-gear',
101
+ 'notebook-kernel-select': 'server-environment',
102
+ 'notebook-mimetype': 'code',
103
+ 'notebook-move-down': 'arrow-down',
104
+ 'notebook-move-up': 'arrow-up',
105
+ 'notebook-open-as-text': 'file-code',
106
+ 'notebook-render-output': 'preview',
107
+ 'notebook-revert': 'discard',
108
+ 'notebook-split-cell': 'split-vertical',
109
+ 'notebook-state-error': 'error',
110
+ 'notebook-state-success': 'check',
111
+ 'notebook-stop': 'primitive-square',
112
+ 'notebook-stop-edit': 'check',
113
+ 'notebook-unfold': 'unfold',
114
+ 'notifications-clear': 'close',
115
+ 'notifications-clear-all': 'clear-all',
116
+ 'notifications-collapse': 'chevron-down',
117
+ 'notifications-configure': 'gear',
118
+ 'notifications-expand': 'chevron-up',
119
+ 'notifications-hide': 'chevron-down',
120
+ 'open-editors-view-icon': 'book',
121
+ 'outline-view-icon': 'symbol-class',
122
+ 'output-view-icon': 'output',
123
+ 'panel-close': 'close',
124
+ 'panel-maximize': 'chevron-up',
125
+ 'panel-restore': 'chevron-down',
126
+ 'parameter-hints-next': 'chevron-down',
127
+ 'parameter-hints-previous': 'chevron-up',
128
+ 'ports-forward-icon': 'plus',
129
+ 'ports-open-browser-icon': 'globe',
130
+ 'ports-stop-forward-icon': 'x',
131
+ 'ports-view-icon': 'plug',
132
+ 'preferences-clear-input': 'clear-all',
133
+ 'preferences-open-settings': 'go-to-file',
134
+ 'private-ports-view-icon': 'lock',
135
+ 'public-ports-view-icon': 'eye',
136
+ 'refactor-preview-view-icon': 'lightbulb',
137
+ 'remote-explorer-documentation': 'book',
138
+ 'remote-explorer-feedback': 'twitter',
139
+ 'remote-explorer-get-started': 'star',
140
+ 'remote-explorer-report-issues': 'comment',
141
+ 'remote-explorer-review-issues': 'issues',
142
+ 'remote-explorer-view-icon': 'remote-explorer',
143
+ 'review-comment-collapse': 'chevron-up',
144
+ 'run-view-icon': 'debug-alt',
145
+ 'search-clear-results': 'clear-all',
146
+ 'search-collapse-results': 'collapse-all',
147
+ 'search-details': 'ellipsis',
148
+ 'search-expand-results': 'expand-all',
149
+ 'search-hide-replace': 'chevron-right',
150
+ 'search-new-editor': 'new-file',
151
+ 'search-refresh': 'refresh',
152
+ 'search-remove': 'close',
153
+ 'search-replace': 'replace',
154
+ 'search-replace-all': 'replace-all',
155
+ 'search-show-context': 'list-selection',
156
+ 'search-show-replace': 'chevron-down',
157
+ 'search-stop': 'search-stop',
158
+ 'search-view-icon': 'search',
159
+ 'settings-add': 'add',
160
+ 'settings-discard': 'discard',
161
+ 'settings-edit': 'edit',
162
+ 'settings-folder-dropdown': 'triangle-down',
163
+ 'settings-group-collapsed': 'chevron-right',
164
+ 'settings-group-expanded': 'chevron-down',
165
+ 'settings-more-action': 'gear',
166
+ 'settings-remove': 'close',
167
+ 'settings-sync-view-icon': 'sync',
168
+ 'settings-view-bar-icon': 'settings-gear',
169
+ 'source-control-view-icon': 'source-control',
170
+ 'suggest-more-info': 'chevron-right',
171
+ 'tasks-list-configure': 'gear',
172
+ 'tasks-remove': 'close',
173
+ 'terminal-kill': 'trash',
174
+ 'terminal-new': 'add',
175
+ 'terminal-rename': 'gear',
176
+ 'terminal-view-icon': 'terminal',
177
+ 'test-view-icon': 'beaker',
178
+ 'testing-cancel-icon': 'close',
179
+ 'testing-debug-icon': 'debug-alt',
180
+ 'testing-error-icon': 'warning',
181
+ 'testing-failed-icon': 'close',
182
+ 'testing-passed-icon': 'pass',
183
+ 'testing-queued-icon': 'watch',
184
+ 'testing-run-all-icon': 'run-all',
185
+ 'testing-run-icon': 'run',
186
+ 'testing-show-as-list-icon': 'list-tree',
187
+ 'testing-skipped-icon': 'debug-step-over',
188
+ 'testing-unset-icon': 'circle-outline',
189
+ 'timeline-open': 'history',
190
+ 'timeline-pin': 'pin',
191
+ 'timeline-refresh': 'refresh',
192
+ 'timeline-unpin': 'pinned',
193
+ 'timeline-view-icon': 'history',
194
+ 'variables-view-icon': 'debug-alt',
195
+ 'view-pane-container-collapsed': 'chevron-right',
196
+ 'view-pane-container-expanded': 'chevron-down',
197
+ 'watch-expressions-add': 'add',
198
+ 'watch-expressions-add-function-breakpoint': 'add',
199
+ 'watch-expressions-remove-all': 'close-all',
200
+ 'watch-view-icon': 'debug-alt',
201
+ 'widget-close': 'close'
202
+ };
203
+
204
+ const originalAsCSSSelector = ThemeIcon.asCSSSelector;
205
+ const originalAsClassName = ThemeIcon.asClassName;
206
+ const originalAsClassNameArray = ThemeIcon.asClassNameArray;
207
+
208
+ function buildMappedIcon(icon: ThemeIcon): ThemeIcon {
209
+ const id = codeIconMap[icon.id] ?? icon.id;
210
+ const newIcon: ThemeIcon = {
211
+ ...icon,
212
+ id
213
+ };
214
+ return newIcon;
215
+ }
216
+
217
+ Object.assign(ThemeIcon, {
218
+ asCSSSelector: (icon: ThemeIcon) => originalAsCSSSelector(buildMappedIcon(icon)),
219
+ asClassName: (icon: ThemeIcon) => originalAsClassName(buildMappedIcon(icon)),
220
+ asClassNameArray: (icon: ThemeIcon) => originalAsClassNameArray(buildMappedIcon(icon))
221
+ });
@@ -490,7 +490,6 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
490
490
  const currentDataWidget = widget.widgets[0];
491
491
  const viewDataWidget = await this.createViewDataWidget(view.id, webviewId);
492
492
  if (widget.isDisposed) {
493
- // eslint-disable-next-line no-unused-expressions
494
493
  viewDataWidget?.dispose();
495
494
  return;
496
495
  }
@@ -22,7 +22,7 @@ import { StatefulWidget } from '@theia/core/lib/browser/shell/shell-layout-resto
22
22
  import { Message } from '@theia/core/shared/@phosphor/messaging';
23
23
  import { TreeViewWidget } from './tree-view-widget';
24
24
  import { DescriptionWidget } from '@theia/core/lib/browser/view-container';
25
- import { DisposableCollection, Emitter } from '@theia/core/lib/common';
25
+ import { DisposableCollection, Emitter, Event } from '@theia/core/lib/common';
26
26
  import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
27
27
 
28
28
  @injectable()
@@ -34,7 +34,14 @@ export class PluginViewWidgetIdentifier {
34
34
  @injectable()
35
35
  export class PluginViewWidget extends Panel implements StatefulWidget, DescriptionWidget {
36
36
 
37
- protected readonly toDispose = new DisposableCollection();
37
+ currentViewContainerId?: string;
38
+
39
+ protected _message?: string;
40
+ protected _description: string = '';
41
+ protected _suppressUpdateViewVisibility = false;
42
+ protected updatingViewVisibility = false;
43
+ protected onDidChangeDescriptionEmitter = new Emitter<void>();
44
+ protected toDispose = new DisposableCollection(this.onDidChangeDescriptionEmitter);
38
45
 
39
46
  @inject(MenuModelRegistry)
40
47
  protected readonly menus: MenuModelRegistry;
@@ -48,16 +55,12 @@ export class PluginViewWidget extends Panel implements StatefulWidget, Descripti
48
55
  @inject(PluginViewWidgetIdentifier)
49
56
  readonly options: PluginViewWidgetIdentifier;
50
57
 
51
- currentViewContainerId: string | undefined;
52
-
53
58
  constructor() {
54
59
  super();
55
60
  this.node.tabIndex = -1;
56
61
  this.node.style.height = '100%';
57
62
  }
58
63
 
59
- public onDidChangeDescription: Emitter<void> = new Emitter<void>();
60
-
61
64
  @postConstruct()
62
65
  protected init(): void {
63
66
  this.id = this.options.id;
@@ -66,6 +69,10 @@ export class PluginViewWidget extends Panel implements StatefulWidget, Descripti
66
69
  this.toDispose.push(localContext);
67
70
  }
68
71
 
72
+ get onDidChangeDescription(): Event<void> {
73
+ return this.onDidChangeDescriptionEmitter.event;
74
+ }
75
+
69
76
  protected override onActivateRequest(msg: Message): void {
70
77
  super.onActivateRequest(msg);
71
78
  const widget = this.widgets[0];
@@ -97,12 +104,10 @@ export class PluginViewWidget extends Panel implements StatefulWidget, Descripti
97
104
  }
98
105
  }
99
106
 
100
- protected _suppressUpdateViewVisibility = false;
101
107
  set suppressUpdateViewVisibility(suppressUpdateViewVisibility: boolean) {
102
108
  this._suppressUpdateViewVisibility = !this.updatingViewVisibility && suppressUpdateViewVisibility;
103
109
  }
104
110
 
105
- protected updatingViewVisibility = false;
106
111
  updateViewVisibility(cb: () => void): void {
107
112
  if (this._suppressUpdateViewVisibility) {
108
113
  return;
@@ -115,7 +120,6 @@ export class PluginViewWidget extends Panel implements StatefulWidget, Descripti
115
120
  }
116
121
  }
117
122
 
118
- private _message: string | undefined;
119
123
  get message(): string | undefined {
120
124
  return this._message;
121
125
  }
@@ -125,14 +129,13 @@ export class PluginViewWidget extends Panel implements StatefulWidget, Descripti
125
129
  this.updateWidgetMessage();
126
130
  }
127
131
 
128
- private _description: string = '';
129
132
  get description(): string {
130
133
  return this._description;
131
134
  }
132
135
 
133
136
  set description(description: string) {
134
137
  this._description = description;
135
- this.onDidChangeDescription.fire();
138
+ this.onDidChangeDescriptionEmitter.fire();
136
139
  }
137
140
 
138
141
  private updateWidgetMessage(): void {
@@ -32,9 +32,9 @@ export class TreeViewDecoratorAdapter extends FileTreeDecoratorAdapter {
32
32
  }
33
33
  }
34
34
 
35
- protected isTreeItem(node: object | undefined): node is TreeItem & { resourceUri: Uri } {
35
+ protected isTreeItem(node: unknown): node is TreeItem & { resourceUri: Uri } {
36
36
  const candidate = node as TreeItem;
37
- return !!candidate && 'resourceUri' in candidate && !!candidate.resourceUri;
37
+ return !!candidate && typeof node === 'object' && 'resourceUri' in candidate && !!candidate.resourceUri;
38
38
  }
39
39
  }
40
40
 
@@ -39,8 +39,10 @@ import { PluginTheiaEnvironment } from '../common/plugin-theia-environment';
39
39
  import { PluginTheiaDeployerParticipant } from './plugin-theia-deployer-participant';
40
40
  import { WebviewBackendSecurityWarnings } from './webview-backend-security-warnings';
41
41
  import { PluginUninstallationManager } from './plugin-uninstallation-manager';
42
+ import { LocalizationBackendContribution } from '@theia/core/lib/node/i18n/localization-backend-contribution';
43
+ import { PluginLocalizationBackendContribution } from './plugin-localization-backend-contribution';
42
44
 
43
- export function bindMainBackend(bind: interfaces.Bind): void {
45
+ export function bindMainBackend(bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind): void {
44
46
  bind(PluginApiContribution).toSelf().inSingletonScope();
45
47
  bind(BackendApplicationContribution).toService(PluginApiContribution);
46
48
  bind(WsRequestValidatorContribution).toService(PluginApiContribution);
@@ -85,4 +87,7 @@ export function bindMainBackend(bind: interfaces.Bind): void {
85
87
 
86
88
  bind(WebviewBackendSecurityWarnings).toSelf().inSingletonScope();
87
89
  bind(BackendApplicationContribution).toService(WebviewBackendSecurityWarnings);
90
+
91
+ rebind(LocalizationBackendContribution).to(PluginLocalizationBackendContribution).inSingletonScope();
92
+
88
93
  }
@@ -0,0 +1,42 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2021 TypeFox 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 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { inject, injectable } from '@theia/core/shared/inversify';
18
+ import { LocalizationBackendContribution } from '@theia/core/lib/node/i18n/localization-backend-contribution';
19
+ import { PluginDeployer } from '../../common/plugin-protocol';
20
+ import { PluginDeployerImpl } from './plugin-deployer-impl';
21
+ import { Deferred } from '@theia/core/lib/common/promise-util';
22
+
23
+ @injectable()
24
+ export class PluginLocalizationBackendContribution extends LocalizationBackendContribution {
25
+ @inject(PluginDeployer)
26
+ protected readonly pluginDeployer: PluginDeployerImpl;
27
+ protected readonly pluginsDeployed = new Deferred();
28
+
29
+ override async initialize(): Promise<void> {
30
+ this.pluginDeployer.onDidDeploy(() => {
31
+ this.pluginsDeployed.resolve();
32
+ });
33
+ await super.initialize();
34
+ }
35
+
36
+ override async waitForInitialization(): Promise<void> {
37
+ await Promise.all([
38
+ super.waitForInitialization(),
39
+ this.pluginsDeployed.promise,
40
+ ]);
41
+ }
42
+ }
@@ -34,13 +34,6 @@ export class AuthenticationExtImpl implements AuthenticationExt {
34
34
  private proxy: AuthenticationMain;
35
35
  private authenticationProviders: Map<string, theia.AuthenticationProvider> = new Map<string, theia.AuthenticationProvider>();
36
36
 
37
- private _providerIds: string[] = [];
38
-
39
- private _providers: theia.AuthenticationProviderInformation[] = [];
40
-
41
- private onDidChangeAuthenticationProvidersEmitter = new Emitter<theia.AuthenticationProvidersChangeEvent>();
42
- readonly onDidChangeAuthenticationProviders: Event<theia.AuthenticationProvidersChangeEvent> = this.onDidChangeAuthenticationProvidersEmitter.event;
43
-
44
37
  private onDidChangeSessionsEmitter = new Emitter<theia.AuthenticationSessionsChangeEvent>();
45
38
  readonly onDidChangeSessions: Event<theia.AuthenticationSessionsChangeEvent> = this.onDidChangeSessionsEmitter.event;
46
39
 
@@ -48,18 +41,6 @@ export class AuthenticationExtImpl implements AuthenticationExt {
48
41
  this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.AUTHENTICATION_MAIN);
49
42
  }
50
43
 
51
- getProviderIds(): Promise<ReadonlyArray<string>> {
52
- return this.proxy.$getProviderIds();
53
- }
54
-
55
- get providerIds(): string[] {
56
- return this._providerIds;
57
- }
58
-
59
- get providers(): ReadonlyArray<theia.AuthenticationProviderInformation> {
60
- return Object.freeze(this._providers.slice());
61
- }
62
-
63
44
  async getSession(requestingExtension: InternalPlugin, providerId: string, scopes: readonly string[],
64
45
  options: theia.AuthenticationGetSessionOptions & ({ createIfNone: true } | { forceNewSession: true } | { forceNewSession: { detail: string } })):
65
46
  Promise<theia.AuthenticationSession>;
@@ -76,29 +57,14 @@ export class AuthenticationExtImpl implements AuthenticationExt {
76
57
  return this.proxy.$getSession(providerId, scopes, extensionId, extensionName, options);
77
58
  }
78
59
 
79
- async logout(providerId: string, sessionId: string): Promise<void> {
80
- return this.proxy.$removeSession(providerId, sessionId);
81
- }
82
-
83
60
  registerAuthenticationProvider(id: string, label: string, provider: theia.AuthenticationProvider, options?: theia.AuthenticationProviderOptions): theia.Disposable {
84
61
  if (this.authenticationProviders.get(id)) {
85
62
  throw new Error(`An authentication provider with id '${id}' is already registered.`);
86
63
  }
87
64
 
88
65
  this.authenticationProviders.set(id, provider);
89
- if (this._providerIds.indexOf(id) === -1) {
90
- this._providerIds.push(id);
91
- }
92
-
93
- if (!this._providers.find(p => p.id === id)) {
94
- this._providers.push({
95
- id,
96
- label
97
- });
98
- }
99
-
100
66
  const listener = provider.onDidChangeSessions(e => {
101
- this.proxy.$sendDidChangeSessions(id, e);
67
+ this.proxy.$onDidChangeSessions(id, e);
102
68
  });
103
69
 
104
70
  this.proxy.$registerAuthenticationProvider(id, label, !!options?.supportsMultipleAccounts);
@@ -106,16 +72,6 @@ export class AuthenticationExtImpl implements AuthenticationExt {
106
72
  return new Disposable(() => {
107
73
  listener.dispose();
108
74
  this.authenticationProviders.delete(id);
109
- const index = this._providerIds.findIndex(pid => id === pid);
110
- if (index > -1) {
111
- this._providerIds.splice(index);
112
- }
113
-
114
- const i = this._providers.findIndex(p => p.id === id);
115
- if (i > -1) {
116
- this._providers.splice(i);
117
- }
118
-
119
75
  this.proxy.$unregisterAuthenticationProvider(id);
120
76
  });
121
77
  }
@@ -163,30 +119,7 @@ export class AuthenticationExtImpl implements AuthenticationExt {
163
119
  throw new Error(`Unable to find authentication provider with handle: ${providerId}`);
164
120
  }
165
121
 
166
- $onDidChangeAuthenticationSessions(id: string, label: string): Promise<void> {
167
- this.onDidChangeSessionsEmitter.fire({ provider: { id, label } });
168
- return Promise.resolve();
169
- }
170
-
171
- async $onDidChangeAuthenticationProviders(added: theia.AuthenticationProviderInformation[], removed: theia.AuthenticationProviderInformation[]): Promise<void> {
172
- added.forEach(id => {
173
- if (this._providers.indexOf(id) === -1) {
174
- this._providers.push(id);
175
- }
176
- });
177
-
178
- removed.forEach(p => {
179
- const index = this._providers.findIndex(provider => provider.id === p.id);
180
- if (index > -1) {
181
- this._providers.splice(index);
182
- }
183
- });
184
-
185
- this.onDidChangeAuthenticationProvidersEmitter.fire({ added, removed });
186
- }
187
-
188
- $setProviders(providers: theia.AuthenticationProviderInformation[]): Promise<void> {
189
- this._providers.push(...providers);
190
- return Promise.resolve(undefined);
122
+ async $onDidChangeAuthenticationSessions(provider: theia.AuthenticationProviderInformation): Promise<void> {
123
+ this.onDidChangeSessionsEmitter.fire({ provider });
191
124
  }
192
125
  }
@@ -31,7 +31,7 @@ import uuid = require('uuid');
31
31
  import { DebugAdapter } from '@theia/debug/lib/common/debug-model';
32
32
  import { PluginDebugAdapterCreator } from './plugin-debug-adapter-creator';
33
33
  import { NodeDebugAdapterCreator } from '../node/debug/plugin-node-debug-adapter-creator';
34
- import { DebugProtocol } from 'vscode-debugprotocol';
34
+ import { DebugProtocol } from '@vscode/debugprotocol';
35
35
 
36
36
  interface ConfigurationProviderRecord {
37
37
  handle: number;
@@ -145,20 +145,17 @@ export class CodeActionAdapter {
145
145
  return this.cacheId++;
146
146
  }
147
147
 
148
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
149
- private static _isCommand(smth: any): smth is theia.Command {
150
- return typeof (<theia.Command>smth).command === 'string';
148
+ private static _isCommand(arg: unknown): arg is theia.Command {
149
+ return !!arg && typeof arg === 'object' && typeof (arg as theia.Command).command === 'string';
151
150
  }
152
151
 
153
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
154
- private static _isSelection(obj: any): obj is Selection {
155
- return (
156
- obj
157
- && (typeof obj.selectionStartLineNumber === 'number')
158
- && (typeof obj.selectionStartColumn === 'number')
159
- && (typeof obj.positionLineNumber === 'number')
160
- && (typeof obj.positionColumn === 'number')
161
- );
152
+ private static _isSelection(obj: unknown): obj is Selection {
153
+ const selection = obj as Selection;
154
+ return !!obj && typeof obj === 'object'
155
+ && typeof selection.selectionStartLineNumber === 'number'
156
+ && typeof selection.selectionStartColumn === 'number'
157
+ && typeof selection.positionLineNumber === 'number'
158
+ && typeof selection.positionColumn === 'number';
162
159
  }
163
160
 
164
161
  }
@@ -55,8 +55,7 @@ export class DocumentHighlightAdapter {
55
55
  });
56
56
  }
57
57
 
58
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
- private isDocumentHighlightArray(array: any): array is types.DocumentHighlight[] {
58
+ private isDocumentHighlightArray(array: unknown): array is types.DocumentHighlight[] {
60
59
  return Array.isArray(array) && array.length > 0 && array[0] instanceof types.DocumentHighlight;
61
60
  }
62
61
  }
@@ -0,0 +1,47 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2022 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 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { URI } from '@theia/core/shared/vscode-uri';
18
+ import * as theia from '@theia/plugin';
19
+ import { Position } from '../../common/plugin-api-rpc';
20
+ import { EvaluatableExpression } from '../../common/plugin-api-rpc-model';
21
+ import { DocumentsExtImpl } from '../documents';
22
+ import * as Converter from '../type-converters';
23
+
24
+ export class EvaluatableExpressionAdapter {
25
+
26
+ constructor(
27
+ private readonly provider: theia.EvaluatableExpressionProvider,
28
+ private readonly documents: DocumentsExtImpl
29
+ ) { }
30
+
31
+ async provideEvaluatableExpression(resource: URI, position: Position, token: theia.CancellationToken): Promise<EvaluatableExpression | undefined> {
32
+ const documentData = this.documents.getDocumentData(resource);
33
+ if (!documentData) {
34
+ return Promise.reject(new Error(`There is no document data for ${resource}`));
35
+ }
36
+
37
+ const document = documentData.document;
38
+ const pos = Converter.toPosition(position);
39
+
40
+ return Promise.resolve(this.provider.provideEvaluatableExpression(document, pos, token)).then(expression => {
41
+ if (!expression) {
42
+ return undefined;
43
+ }
44
+ return Converter.fromEvaluatableExpression(expression);
45
+ });
46
+ }
47
+ }
@@ -17,12 +17,10 @@
17
17
  import * as theia from '@theia/plugin';
18
18
  import * as types from '../types-impl';
19
19
 
20
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
- export function isLocationArray(array: any): array is types.Location[] {
20
+ export function isLocationArray(array: unknown): array is types.Location[] {
22
21
  return Array.isArray(array) && array.length > 0 && array[0] instanceof types.Location;
23
22
  }
24
23
 
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
- export function isDefinitionLinkArray(array: any): array is theia.DefinitionLink[] {
24
+ export function isDefinitionLinkArray(array: unknown): array is theia.DefinitionLink[] {
27
25
  return Array.isArray(array) && array.length > 0 && array[0].hasOwnProperty('targetUri') && array[0].hasOwnProperty('targetRange');
28
26
  }