@theia/plugin-ext 1.29.0-next.2 → 1.29.0-next.23
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/lib/common/plugin-api-rpc-model.d.ts +7 -0
- package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc-model.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +15 -9
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/rpc-protocol.d.ts +1 -1
- package/lib/common/rpc-protocol.d.ts.map +1 -1
- package/lib/common/rpc-protocol.js +3 -3
- package/lib/common/rpc-protocol.js.map +1 -1
- package/lib/main/browser/comments/comment-thread-widget.d.ts +2 -0
- package/lib/main/browser/comments/comment-thread-widget.d.ts.map +1 -1
- package/lib/main/browser/comments/comment-thread-widget.js +4 -3
- package/lib/main/browser/comments/comment-thread-widget.js.map +1 -1
- package/lib/main/browser/debug/debug-main.d.ts.map +1 -1
- package/lib/main/browser/debug/debug-main.js +20 -10
- package/lib/main/browser/debug/debug-main.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +4 -4
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
- package/lib/main/browser/languages-main.d.ts +6 -1
- package/lib/main/browser/languages-main.d.ts.map +1 -1
- package/lib/main/browser/languages-main.js +15 -1
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.d.ts +1 -0
- package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.js +1 -0
- package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
- package/lib/main/browser/preference-registry-main.d.ts +4 -3
- package/lib/main/browser/preference-registry-main.d.ts.map +1 -1
- package/lib/main/browser/preference-registry-main.js +26 -14
- package/lib/main/browser/preference-registry-main.js.map +1 -1
- package/lib/main/browser/theme-icon-override.d.ts +2 -0
- package/lib/main/browser/theme-icon-override.d.ts.map +1 -0
- package/lib/main/browser/theme-icon-override.js +217 -0
- package/lib/main/browser/theme-icon-override.js.map +1 -0
- package/lib/main/browser/view/tree-view-decorator-service.d.ts +1 -1
- package/lib/main/browser/view/tree-view-decorator-service.d.ts.map +1 -1
- package/lib/main/browser/view/tree-view-decorator-service.js +1 -1
- package/lib/main/browser/view/tree-view-decorator-service.js.map +1 -1
- package/lib/plugin/languages/code-action.d.ts.map +1 -1
- package/lib/plugin/languages/code-action.js +8 -9
- package/lib/plugin/languages/code-action.js.map +1 -1
- package/lib/plugin/languages/document-highlight.d.ts.map +1 -1
- package/lib/plugin/languages/document-highlight.js +0 -1
- package/lib/plugin/languages/document-highlight.js.map +1 -1
- package/lib/plugin/languages/evaluatable-expression.d.ts +12 -0
- package/lib/plugin/languages/evaluatable-expression.d.ts.map +1 -0
- package/lib/plugin/languages/evaluatable-expression.js +41 -0
- package/lib/plugin/languages/evaluatable-expression.js.map +1 -0
- package/lib/plugin/languages/util.d.ts +2 -2
- package/lib/plugin/languages/util.d.ts.map +1 -1
- package/lib/plugin/languages/util.js +0 -2
- package/lib/plugin/languages/util.js.map +1 -1
- package/lib/plugin/languages.d.ts +3 -1
- package/lib/plugin/languages.d.ts.map +1 -1
- package/lib/plugin/languages.js +11 -0
- package/lib/plugin/languages.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +4 -0
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-storage.d.ts +1 -0
- package/lib/plugin/plugin-storage.d.ts.map +1 -1
- package/lib/plugin/plugin-storage.js +3 -0
- package/lib/plugin/plugin-storage.js.map +1 -1
- package/lib/plugin/preference-registry.d.ts +15 -2
- package/lib/plugin/preference-registry.d.ts.map +1 -1
- package/lib/plugin/preference-registry.js +105 -62
- package/lib/plugin/preference-registry.js.map +1 -1
- package/lib/plugin/preference-registry.spec.js +207 -35
- package/lib/plugin/preference-registry.spec.js.map +1 -1
- package/lib/plugin/type-converters.d.ts +7 -6
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +54 -55
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +8 -3
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +22 -10
- package/lib/plugin/types-impl.js.map +1 -1
- package/package.json +24 -24
- package/src/common/plugin-api-rpc-model.ts +10 -0
- package/src/common/plugin-api-rpc.ts +18 -9
- package/src/common/rpc-protocol.ts +5 -5
- package/src/main/browser/comments/comment-thread-widget.tsx +5 -3
- package/src/main/browser/debug/debug-main.ts +19 -11
- package/src/main/browser/debug/plugin-debug-session-factory.ts +3 -3
- package/src/main/browser/languages-main.ts +23 -1
- package/src/main/browser/plugin-ext-frontend-module.ts +1 -0
- package/src/main/browser/preference-registry-main.ts +23 -14
- package/src/main/browser/theme-icon-override.ts +221 -0
- package/src/main/browser/view/tree-view-decorator-service.ts +2 -2
- package/src/plugin/languages/code-action.ts +9 -12
- package/src/plugin/languages/document-highlight.ts +1 -2
- package/src/plugin/languages/evaluatable-expression.ts +47 -0
- package/src/plugin/languages/util.ts +2 -4
- package/src/plugin/languages.ts +15 -0
- package/src/plugin/plugin-context.ts +6 -1
- package/src/plugin/plugin-storage.ts +4 -0
- package/src/plugin/preference-registry.spec.ts +247 -39
- package/src/plugin/preference-registry.ts +107 -71
- package/src/plugin/type-converters.ts +58 -59
- package/src/plugin/types-impl.ts +30 -14
- package/lib/plugin/preferences/configuration.d.ts +0 -35
- package/lib/plugin/preferences/configuration.d.ts.map +0 -1
- package/lib/plugin/preferences/configuration.js +0 -137
- package/lib/plugin/preferences/configuration.js.map +0 -1
- package/lib/plugin/preferences/configuration.spec.d.ts +0 -2
- package/lib/plugin/preferences/configuration.spec.d.ts.map +0 -1
- package/lib/plugin/preferences/configuration.spec.js +0 -178
- package/lib/plugin/preferences/configuration.spec.js.map +0 -1
- package/src/plugin/preferences/configuration.spec.ts +0 -292
- package/src/plugin/preferences/configuration.ts +0 -167
|
@@ -66,6 +66,9 @@ import * as MonacoPath from '@theia/monaco-editor-core/esm/vs/base/common/path';
|
|
|
66
66
|
import { IRelativePattern } from '@theia/monaco-editor-core/esm/vs/base/common/glob';
|
|
67
67
|
import { EditorLanguageStatusService, LanguageStatus as EditorLanguageStatus } from '@theia/editor/lib/browser/language-status/editor-language-status-service';
|
|
68
68
|
import { LanguageSelector, RelativePattern } from '@theia/editor/lib/common/language-selector';
|
|
69
|
+
import { ILanguageFeaturesService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/languageFeatures';
|
|
70
|
+
import { EvaluatableExpression, EvaluatableExpressionProvider } from '@theia/monaco-editor-core/esm/vs/editor/common/languages';
|
|
71
|
+
import { ITextModel } from '@theia/monaco-editor-core/esm/vs/editor/common/model';
|
|
69
72
|
|
|
70
73
|
/**
|
|
71
74
|
* @monaco-uplift The public API declares these functions as (languageId: string, service).
|
|
@@ -338,7 +341,26 @@ export class LanguagesMainImpl implements LanguagesMain, Disposable {
|
|
|
338
341
|
return this.proxy.$provideHover(handle, model.uri, position, token);
|
|
339
342
|
}
|
|
340
343
|
|
|
341
|
-
$
|
|
344
|
+
$registerEvaluatableExpressionProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void {
|
|
345
|
+
const languageSelector = this.toLanguageSelector(selector);
|
|
346
|
+
const evaluatableExpressionProvider = this.createEvaluatableExpressionProvider(handle);
|
|
347
|
+
this.register(handle,
|
|
348
|
+
(StandaloneServices.get(ILanguageFeaturesService).evaluatableExpressionProvider.register as RegistrationFunction<EvaluatableExpressionProvider>)
|
|
349
|
+
(languageSelector, evaluatableExpressionProvider));
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
protected createEvaluatableExpressionProvider(handle: number): EvaluatableExpressionProvider {
|
|
353
|
+
return {
|
|
354
|
+
provideEvaluatableExpression: (model, position, token) => this.provideEvaluatableExpression(handle, model, position, token)
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
protected provideEvaluatableExpression(handle: number, model: ITextModel, position: monaco.Position,
|
|
359
|
+
token: monaco.CancellationToken): monaco.languages.ProviderResult<EvaluatableExpression | undefined> {
|
|
360
|
+
return this.proxy.$provideEvaluatableExpression(handle, model.uri, position, token);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
$registerDocumentHighlightProvider(handle: number, _pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void {
|
|
342
364
|
const languageSelector = this.toLanguageSelector(selector);
|
|
343
365
|
const documentHighlightProvider = this.createDocumentHighlightProvider(handle);
|
|
344
366
|
this.register(handle, (monaco.languages.registerDocumentHighlightProvider as RegistrationFunction<monaco.languages.DocumentHighlightProvider>)
|
|
@@ -79,6 +79,7 @@ import { AuthenticationService } from '@theia/core/lib/browser/authentication-se
|
|
|
79
79
|
import { bindTreeViewDecoratorUtilities, TreeViewDecoratorService } from './view/tree-view-decorator-service';
|
|
80
80
|
import { CodeEditorWidgetUtil } from './menus/vscode-theia-menu-mappings';
|
|
81
81
|
import { PluginMenuCommandAdapter } from './menus/plugin-menu-command-adapter';
|
|
82
|
+
import './theme-icon-override';
|
|
82
83
|
|
|
83
84
|
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
84
85
|
|
|
@@ -70,11 +70,10 @@ export class PreferenceRegistryMainImpl implements PreferenceRegistryMain, Dispo
|
|
|
70
70
|
|
|
71
71
|
const roots = workspaceService.tryGetRoots();
|
|
72
72
|
const data = getPreferences(preferenceProviderProvider, roots);
|
|
73
|
-
const eventData
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
73
|
+
const eventData = Object.values(changes).map<PreferenceChangeExt>(({ scope, newValue, domain, preferenceName }) => {
|
|
74
|
+
const extScope = scope === PreferenceScope.User ? undefined : domain?.[0];
|
|
75
|
+
return { preferenceName, newValue, scope: extScope };
|
|
76
|
+
});
|
|
78
77
|
this.proxy.$acceptConfigurationChanged(data, eventData);
|
|
79
78
|
}));
|
|
80
79
|
}
|
|
@@ -84,17 +83,19 @@ export class PreferenceRegistryMainImpl implements PreferenceRegistryMain, Dispo
|
|
|
84
83
|
}
|
|
85
84
|
|
|
86
85
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
-
async $updateConfigurationOption(target: boolean | ConfigurationTarget | undefined, key: string, value: any, resource?: string): Promise<void> {
|
|
88
|
-
const scope = this.parseConfigurationTarget(target);
|
|
89
|
-
|
|
86
|
+
async $updateConfigurationOption(target: boolean | ConfigurationTarget | undefined, key: string, value: any, resource?: string, withLanguageOverride?: boolean): Promise<void> {
|
|
87
|
+
const scope = this.parseConfigurationTarget(target, resource);
|
|
88
|
+
const effectiveKey = this.getEffectiveKey(key, scope, withLanguageOverride, resource);
|
|
89
|
+
await this.preferenceService.set(effectiveKey, value, scope, resource);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
async $removeConfigurationOption(target: boolean | ConfigurationTarget | undefined, key: string, resource?: string): Promise<void> {
|
|
93
|
-
const scope = this.parseConfigurationTarget(target);
|
|
94
|
-
|
|
92
|
+
async $removeConfigurationOption(target: boolean | ConfigurationTarget | undefined, key: string, resource?: string, withLanguageOverride?: boolean): Promise<void> {
|
|
93
|
+
const scope = this.parseConfigurationTarget(target, resource);
|
|
94
|
+
const effectiveKey = this.getEffectiveKey(key, scope, withLanguageOverride, resource);
|
|
95
|
+
await this.preferenceService.set(effectiveKey, undefined, scope, resource);
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
private parseConfigurationTarget(target?: boolean | ConfigurationTarget): PreferenceScope
|
|
98
|
+
private parseConfigurationTarget(target?: boolean | ConfigurationTarget, resource?: string): PreferenceScope {
|
|
98
99
|
if (typeof target === 'boolean') {
|
|
99
100
|
return target ? PreferenceScope.User : PreferenceScope.Workspace;
|
|
100
101
|
}
|
|
@@ -106,9 +107,17 @@ export class PreferenceRegistryMainImpl implements PreferenceRegistryMain, Dispo
|
|
|
106
107
|
case ConfigurationTarget.WorkspaceFolder:
|
|
107
108
|
return PreferenceScope.Folder;
|
|
108
109
|
default:
|
|
109
|
-
|
|
110
|
-
return undefined;
|
|
110
|
+
return resource ? PreferenceScope.Folder : PreferenceScope.Workspace;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
// If the caller does not set `withLanguageOverride = true`, we have to check whether the setting exists with that override already.
|
|
115
|
+
protected getEffectiveKey(key: string, scope: PreferenceScope, withLanguageOverride?: boolean, resource?: string): string {
|
|
116
|
+
if (withLanguageOverride) { return key; }
|
|
117
|
+
const overridden = this.preferenceService.overriddenPreferenceName(key);
|
|
118
|
+
if (!overridden) { return key; }
|
|
119
|
+
const value = this.preferenceService.inspectInScope(key, scope, resource, withLanguageOverride);
|
|
120
|
+
return value === undefined ? overridden.preferenceName : key;
|
|
121
|
+
}
|
|
122
|
+
|
|
114
123
|
}
|
|
@@ -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
|
+
});
|
|
@@ -32,9 +32,9 @@ export class TreeViewDecoratorAdapter extends FileTreeDecoratorAdapter {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
protected isTreeItem(node:
|
|
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
|
|
|
@@ -145,20 +145,17 @@ export class CodeActionAdapter {
|
|
|
145
145
|
return this.cacheId++;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
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
|
-
|
|
154
|
-
|
|
155
|
-
return
|
|
156
|
-
|
|
157
|
-
&&
|
|
158
|
-
&&
|
|
159
|
-
&&
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
}
|
package/src/plugin/languages.ts
CHANGED
|
@@ -62,11 +62,13 @@ import {
|
|
|
62
62
|
CallHierarchyIncomingCall,
|
|
63
63
|
CallHierarchyOutgoingCall,
|
|
64
64
|
LinkedEditingRanges,
|
|
65
|
+
EvaluatableExpression
|
|
65
66
|
} from '../common/plugin-api-rpc-model';
|
|
66
67
|
import { CompletionAdapter } from './languages/completion';
|
|
67
68
|
import { Diagnostics } from './languages/diagnostics';
|
|
68
69
|
import { SignatureHelpAdapter } from './languages/signature';
|
|
69
70
|
import { HoverAdapter } from './languages/hover';
|
|
71
|
+
import { EvaluatableExpressionAdapter } from './languages/evaluatable-expression';
|
|
70
72
|
import { DocumentHighlightAdapter } from './languages/document-highlight';
|
|
71
73
|
import { DocumentFormattingAdapter } from './languages/document-formatting';
|
|
72
74
|
import { RangeFormattingAdapter } from './languages/range-formatting';
|
|
@@ -100,6 +102,7 @@ import { serializeEnterRules, serializeIndentation, serializeRegExp } from './la
|
|
|
100
102
|
type Adapter = CompletionAdapter |
|
|
101
103
|
SignatureHelpAdapter |
|
|
102
104
|
HoverAdapter |
|
|
105
|
+
EvaluatableExpressionAdapter |
|
|
103
106
|
DocumentHighlightAdapter |
|
|
104
107
|
DocumentFormattingAdapter |
|
|
105
108
|
RangeFormattingAdapter |
|
|
@@ -350,6 +353,18 @@ export class LanguagesExtImpl implements LanguagesExt {
|
|
|
350
353
|
}
|
|
351
354
|
// ### Hover Provider end
|
|
352
355
|
|
|
356
|
+
// ### EvaluatableExpression Provider begin
|
|
357
|
+
registerEvaluatableExpressionProvider(selector: theia.DocumentSelector, provider: theia.EvaluatableExpressionProvider, pluginInfo: PluginInfo): theia.Disposable {
|
|
358
|
+
const callId = this.addNewAdapter(new EvaluatableExpressionAdapter(provider, this.documents));
|
|
359
|
+
this.proxy.$registerEvaluatableExpressionProvider(callId, pluginInfo, this.transformDocumentSelector(selector));
|
|
360
|
+
return this.createDisposable(callId);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
$provideEvaluatableExpression(handle: number, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise<EvaluatableExpression | undefined> {
|
|
364
|
+
return this.withAdapter(handle, EvaluatableExpressionAdapter, adapter => adapter.provideEvaluatableExpression(URI.revive(resource), position, token), undefined);
|
|
365
|
+
}
|
|
366
|
+
// ### EvaluatableExpression Provider end
|
|
367
|
+
|
|
353
368
|
// ### Document Highlight Provider begin
|
|
354
369
|
registerDocumentHighlightProvider(selector: theia.DocumentSelector, provider: theia.DocumentHighlightProvider, pluginInfo: PluginInfo): theia.Disposable {
|
|
355
370
|
const callId = this.addNewAdapter(new DocumentHighlightAdapter(provider, this.documents));
|
|
@@ -78,6 +78,7 @@ import {
|
|
|
78
78
|
SignatureHelp,
|
|
79
79
|
SignatureHelpTriggerKind,
|
|
80
80
|
Hover,
|
|
81
|
+
EvaluatableExpression,
|
|
81
82
|
DocumentHighlightKind,
|
|
82
83
|
DocumentHighlight,
|
|
83
84
|
DocumentLink,
|
|
@@ -559,7 +560,7 @@ export function createAPIFactory(
|
|
|
559
560
|
extHostFileSystemEvent.getOnWillDeleteFileEvent(plugin)(listener, thisArg, disposables),
|
|
560
561
|
onWillRenameFiles: (listener: (e: theia.FileWillRenameEvent) => any, thisArg?: any, disposables?: theia.Disposable[]) =>
|
|
561
562
|
extHostFileSystemEvent.getOnWillRenameFileEvent(plugin)(listener, thisArg, disposables),
|
|
562
|
-
getConfiguration(section
|
|
563
|
+
getConfiguration(section, resource): theia.WorkspaceConfiguration {
|
|
563
564
|
return preferenceRegistryExt.getConfiguration(section, resource);
|
|
564
565
|
},
|
|
565
566
|
onDidChangeConfiguration(listener, thisArgs?, disposables?): theia.Disposable {
|
|
@@ -731,6 +732,9 @@ export function createAPIFactory(
|
|
|
731
732
|
registerHoverProvider(selector: theia.DocumentSelector, provider: theia.HoverProvider): theia.Disposable {
|
|
732
733
|
return languagesExt.registerHoverProvider(selector, provider, pluginToPluginInfo(plugin));
|
|
733
734
|
},
|
|
735
|
+
registerEvaluatableExpressionProvider(selector: theia.DocumentSelector, provider: theia.EvaluatableExpressionProvider): theia.Disposable {
|
|
736
|
+
return languagesExt.registerEvaluatableExpressionProvider(selector, provider, pluginToPluginInfo(plugin));
|
|
737
|
+
},
|
|
734
738
|
registerDocumentHighlightProvider(selector: theia.DocumentSelector, provider: theia.DocumentHighlightProvider): theia.Disposable {
|
|
735
739
|
return languagesExt.registerDocumentHighlightProvider(selector, provider, pluginToPluginInfo(plugin));
|
|
736
740
|
},
|
|
@@ -991,6 +995,7 @@ export function createAPIFactory(
|
|
|
991
995
|
SignatureHelp,
|
|
992
996
|
SignatureHelpTriggerKind,
|
|
993
997
|
Hover,
|
|
998
|
+
EvaluatableExpression,
|
|
994
999
|
DocumentHighlightKind,
|
|
995
1000
|
DocumentHighlight,
|
|
996
1001
|
DocumentLink,
|
|
@@ -38,6 +38,10 @@ export class Memento implements theia.Memento {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
keys(): string[] {
|
|
42
|
+
return Object.entries(this.cache).filter(([, value]) => value !== undefined).map(([key]) => key);
|
|
43
|
+
}
|
|
44
|
+
|
|
41
45
|
get<T>(key: string): T | undefined;
|
|
42
46
|
get<T>(key: string, defaultValue: T): T;
|
|
43
47
|
get<T>(key: string, defaultValue?: T): T | undefined {
|