@theia/plugin-ext 1.67.0-next.3 → 1.67.0-next.59
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/README.md +1 -1
- package/lib/common/plugin-api-rpc.d.ts +1 -2
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/main/browser/languages-main.d.ts +2 -2
- package/lib/main/browser/languages-main.d.ts.map +1 -1
- package/lib/main/browser/languages-main.js +11 -4
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-editors-main.js +2 -3
- package/lib/main/browser/notebooks/notebook-editors-main.js.map +1 -1
- package/lib/main/browser/notebooks/renderers/cell-output-webview.js +1 -1
- package/lib/main/browser/notebooks/renderers/cell-output-webview.js.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.js +0 -6
- package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.d.ts +2 -12
- package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.js +1 -36
- package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
- package/lib/main/browser/view/tree-views-main.d.ts +1 -0
- package/lib/main/browser/view/tree-views-main.d.ts.map +1 -1
- package/lib/main/browser/view/tree-views-main.js +2 -2
- package/lib/main/browser/view/tree-views-main.js.map +1 -1
- package/lib/main/browser/webview/webview.d.ts +3 -14
- package/lib/main/browser/webview/webview.d.ts.map +1 -1
- package/lib/main/browser/webview/webview.js +0 -24
- package/lib/main/browser/webview/webview.js.map +1 -1
- package/lib/main/browser/webview-views/webview-views-main.d.ts +2 -1
- package/lib/main/browser/webview-views/webview-views-main.d.ts.map +1 -1
- package/lib/main/browser/webview-views/webview-views-main.js +6 -2
- package/lib/main/browser/webview-views/webview-views-main.js.map +1 -1
- package/lib/main/browser/webview-views/webview-views.d.ts +0 -4
- package/lib/main/browser/webview-views/webview-views.d.ts.map +1 -1
- package/lib/main/browser/webviews-main.d.ts +1 -2
- package/lib/main/browser/webviews-main.d.ts.map +1 -1
- package/lib/main/browser/webviews-main.js +0 -7
- package/lib/main/browser/webviews-main.js.map +1 -1
- package/lib/plugin/authentication-ext.d.ts.map +1 -1
- package/lib/plugin/authentication-ext.js +1 -0
- package/lib/plugin/authentication-ext.js.map +1 -1
- package/lib/plugin/languages.d.ts.map +1 -1
- package/lib/plugin/languages.js +17 -10
- package/lib/plugin/languages.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +3 -1
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/timeline.d.ts.map +1 -1
- package/lib/plugin/timeline.js +6 -3
- package/lib/plugin/timeline.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +39 -17
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +35 -10
- package/lib/plugin/types-impl.js.map +1 -1
- package/package.json +29 -29
- package/src/common/plugin-api-rpc.ts +2 -2
- package/src/main/browser/languages-main.ts +14 -4
- package/src/main/browser/notebooks/notebook-editors-main.ts +2 -2
- package/src/main/browser/notebooks/renderers/cell-output-webview.tsx +1 -1
- package/src/main/browser/view/plugin-view-registry.ts +0 -9
- package/src/main/browser/view/plugin-view-widget.ts +3 -45
- package/src/main/browser/view/tree-views-main.ts +5 -3
- package/src/main/browser/webview/webview.ts +2 -36
- package/src/main/browser/webview-views/webview-views-main.ts +8 -3
- package/src/main/browser/webview-views/webview-views.ts +0 -4
- package/src/main/browser/webviews-main.ts +1 -9
- package/src/plugin/authentication-ext.ts +1 -0
- package/src/plugin/languages.ts +17 -13
- package/src/plugin/plugin-context.ts +5 -1
- package/src/plugin/timeline.ts +7 -3
- package/src/plugin/types-impl.ts +55 -18
|
@@ -21,7 +21,7 @@ import { CommandRegistry } from '@theia/core/lib/common/command';
|
|
|
21
21
|
import { StatefulWidget } from '@theia/core/lib/browser/shell/shell-layout-restorer';
|
|
22
22
|
import { Message } from '@theia/core/shared/@lumino/messaging';
|
|
23
23
|
import { TreeViewWidget } from './tree-view-widget';
|
|
24
|
-
import {
|
|
24
|
+
import { DescriptionWidget, DynamicToolbarWidget } from '@theia/core/lib/browser/view-container';
|
|
25
25
|
import { DisposableCollection, Emitter, Event } from '@theia/core/lib/common';
|
|
26
26
|
import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
|
|
27
27
|
|
|
@@ -32,20 +32,16 @@ export class PluginViewWidgetIdentifier {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
@injectable()
|
|
35
|
-
export class PluginViewWidget extends Panel implements StatefulWidget, DescriptionWidget,
|
|
35
|
+
export class PluginViewWidget extends Panel implements StatefulWidget, DescriptionWidget, DynamicToolbarWidget {
|
|
36
36
|
|
|
37
37
|
currentViewContainerId?: string;
|
|
38
38
|
|
|
39
39
|
protected _message?: string;
|
|
40
40
|
protected _description: string = '';
|
|
41
|
-
protected _badge?: number | undefined;
|
|
42
|
-
protected _badgeTooltip?: string | undefined;
|
|
43
41
|
protected _suppressUpdateViewVisibility = false;
|
|
44
42
|
protected updatingViewVisibility = false;
|
|
45
43
|
protected onDidChangeDescriptionEmitter = new Emitter<void>();
|
|
46
|
-
protected
|
|
47
|
-
protected onDidChangeBadgeTooltipEmitter = new Emitter<void>();
|
|
48
|
-
protected toDispose = new DisposableCollection(this.onDidChangeDescriptionEmitter, this.onDidChangeBadgeEmitter, this.onDidChangeBadgeTooltipEmitter);
|
|
44
|
+
protected toDispose = new DisposableCollection(this.onDidChangeDescriptionEmitter);
|
|
49
45
|
protected readonly onDidChangeToolbarItemsEmitter = new Emitter<void>();
|
|
50
46
|
|
|
51
47
|
get onDidChangeToolbarItems(): Event<void> {
|
|
@@ -81,14 +77,6 @@ export class PluginViewWidget extends Panel implements StatefulWidget, Descripti
|
|
|
81
77
|
return this.onDidChangeDescriptionEmitter.event;
|
|
82
78
|
}
|
|
83
79
|
|
|
84
|
-
get onDidChangeBadge(): Event<void> {
|
|
85
|
-
return this.onDidChangeBadgeEmitter.event;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
get onDidChangeBadgeTooltip(): Event<void> {
|
|
89
|
-
return this.onDidChangeBadgeTooltipEmitter.event;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
80
|
protected override onActivateRequest(msg: Message): void {
|
|
93
81
|
super.onActivateRequest(msg);
|
|
94
82
|
const widget = this.widgets[0];
|
|
@@ -154,32 +142,6 @@ export class PluginViewWidget extends Panel implements StatefulWidget, Descripti
|
|
|
154
142
|
this.onDidChangeDescriptionEmitter.fire();
|
|
155
143
|
}
|
|
156
144
|
|
|
157
|
-
get badge(): number | undefined {
|
|
158
|
-
const widget = this.widgets[0];
|
|
159
|
-
if (BadgeWidget.is(widget)) {
|
|
160
|
-
return widget.badge;
|
|
161
|
-
}
|
|
162
|
-
return this._badge;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
set badge(badge: number | undefined) {
|
|
166
|
-
this._badge = badge;
|
|
167
|
-
this.onDidChangeBadgeEmitter.fire();
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
get badgeTooltip(): string | undefined {
|
|
171
|
-
const widget = this.widgets[0];
|
|
172
|
-
if (BadgeWidget.is(widget)) {
|
|
173
|
-
return widget.badgeTooltip;
|
|
174
|
-
}
|
|
175
|
-
return this._badgeTooltip;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
set badgeTooltip(badgeTooltip: string | undefined) {
|
|
179
|
-
this._badgeTooltip = badgeTooltip;
|
|
180
|
-
this.onDidChangeBadgeTooltipEmitter.fire();
|
|
181
|
-
}
|
|
182
|
-
|
|
183
145
|
private updateWidgetMessage(): void {
|
|
184
146
|
const widget = this.widgets[0];
|
|
185
147
|
if (widget) {
|
|
@@ -191,10 +153,6 @@ export class PluginViewWidget extends Panel implements StatefulWidget, Descripti
|
|
|
191
153
|
|
|
192
154
|
override addWidget(widget: Widget): void {
|
|
193
155
|
super.addWidget(widget);
|
|
194
|
-
if (BadgeWidget.is(widget)) {
|
|
195
|
-
widget.onDidChangeBadge(() => this.onDidChangeBadgeEmitter.fire());
|
|
196
|
-
widget.onDidChangeBadgeTooltip(() => this.onDidChangeBadgeTooltipEmitter.fire());
|
|
197
|
-
}
|
|
198
156
|
this.updateWidgetMessage();
|
|
199
157
|
this.onDidChangeToolbarItemsEmitter.fire();
|
|
200
158
|
}
|
|
@@ -22,7 +22,8 @@ import {
|
|
|
22
22
|
SelectableTreeNode,
|
|
23
23
|
ExpandableTreeNode,
|
|
24
24
|
CompositeTreeNode,
|
|
25
|
-
WidgetManager
|
|
25
|
+
WidgetManager,
|
|
26
|
+
BadgeService
|
|
26
27
|
} from '@theia/core/lib/browser';
|
|
27
28
|
import { Disposable, DisposableCollection } from '@theia/core';
|
|
28
29
|
import { TreeViewWidget, TreeViewNode, PluginTreeModel, TreeViewWidgetOptions } from './tree-view-widget';
|
|
@@ -37,6 +38,7 @@ export class TreeViewsMainImpl implements TreeViewsMain, Disposable {
|
|
|
37
38
|
private readonly viewRegistry: PluginViewRegistry;
|
|
38
39
|
private readonly widgetManager: WidgetManager;
|
|
39
40
|
private readonly fileContentStore: DnDFileContentStore;
|
|
41
|
+
private readonly badgeService: BadgeService;
|
|
40
42
|
|
|
41
43
|
private readonly treeViewProviders = new Map<string, Disposable>();
|
|
42
44
|
|
|
@@ -50,6 +52,7 @@ export class TreeViewsMainImpl implements TreeViewsMain, Disposable {
|
|
|
50
52
|
|
|
51
53
|
this.widgetManager = this.container.get(WidgetManager);
|
|
52
54
|
this.fileContentStore = this.container.get(DnDFileContentStore);
|
|
55
|
+
this.badgeService = this.container.get(BadgeService);
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
dispose(): void {
|
|
@@ -176,8 +179,7 @@ export class TreeViewsMainImpl implements TreeViewsMain, Disposable {
|
|
|
176
179
|
async $setBadge(treeViewId: string, badge: ViewBadge | undefined): Promise<void> {
|
|
177
180
|
const viewPanel = await this.viewRegistry.getView(treeViewId);
|
|
178
181
|
if (viewPanel) {
|
|
179
|
-
viewPanel
|
|
180
|
-
viewPanel.badgeTooltip = badge?.tooltip;
|
|
182
|
+
this.badgeService.showBadge(viewPanel, badge);
|
|
181
183
|
}
|
|
182
184
|
}
|
|
183
185
|
|
|
@@ -33,7 +33,7 @@ import { IconUrl } from '../../../common/plugin-protocol';
|
|
|
33
33
|
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
34
34
|
import { WebviewEnvironment } from './webview-environment';
|
|
35
35
|
import URI from '@theia/core/lib/common/uri';
|
|
36
|
-
import { Emitter
|
|
36
|
+
import { Emitter } from '@theia/core/lib/common/event';
|
|
37
37
|
import { open, OpenerService } from '@theia/core/lib/browser/opener-service';
|
|
38
38
|
import { KeybindingRegistry } from '@theia/core/lib/browser/keybinding';
|
|
39
39
|
import { Schemes } from '../../../common/uri-components';
|
|
@@ -48,7 +48,6 @@ import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
|
48
48
|
import { FileOperationError, FileOperationResult } from '@theia/filesystem/lib/common/files';
|
|
49
49
|
import { BinaryBufferReadableStream } from '@theia/core/lib/common/buffer';
|
|
50
50
|
import { ExtractableWidget } from '@theia/core/lib/browser/widgets/extractable-widget';
|
|
51
|
-
import { BadgeWidget } from '@theia/core/lib/browser/view-container';
|
|
52
51
|
import { MenuPath } from '@theia/core';
|
|
53
52
|
import { ContextMenuRenderer } from '@theia/core/lib/browser';
|
|
54
53
|
import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
|
|
@@ -102,7 +101,7 @@ export class WebviewWidgetIdentifier {
|
|
|
102
101
|
export const WebviewWidgetExternalEndpoint = Symbol('WebviewWidgetExternalEndpoint');
|
|
103
102
|
|
|
104
103
|
@injectable()
|
|
105
|
-
export class WebviewWidget extends BaseWidget implements StatefulWidget, ExtractableWidget
|
|
104
|
+
export class WebviewWidget extends BaseWidget implements StatefulWidget, ExtractableWidget {
|
|
106
105
|
|
|
107
106
|
private static readonly standardSupportedLinkSchemes = new Set([
|
|
108
107
|
Schemes.http,
|
|
@@ -199,11 +198,6 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget, Extract
|
|
|
199
198
|
isExtractable: boolean = true;
|
|
200
199
|
secondaryWindow: Window | undefined = undefined;
|
|
201
200
|
|
|
202
|
-
protected _badge?: number | undefined;
|
|
203
|
-
protected _badgeTooltip?: string | undefined;
|
|
204
|
-
protected onDidChangeBadgeEmitter = new Emitter<void>();
|
|
205
|
-
protected onDidChangeBadgeTooltipEmitter = new Emitter<void>();
|
|
206
|
-
|
|
207
201
|
@postConstruct()
|
|
208
202
|
protected init(): void {
|
|
209
203
|
this.node.tabIndex = 0;
|
|
@@ -212,8 +206,6 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget, Extract
|
|
|
212
206
|
this.addClass(WebviewWidget.Styles.WEBVIEW);
|
|
213
207
|
|
|
214
208
|
this.toDispose.push(this.onMessageEmitter);
|
|
215
|
-
this.toDispose.push(this.onDidChangeBadgeEmitter);
|
|
216
|
-
this.toDispose.push(this.onDidChangeBadgeTooltipEmitter);
|
|
217
209
|
|
|
218
210
|
this.transparentOverlay = document.createElement('div');
|
|
219
211
|
this.transparentOverlay.classList.add(TRANSPARENT_OVERLAY_STYLE);
|
|
@@ -232,32 +224,6 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget, Extract
|
|
|
232
224
|
}));
|
|
233
225
|
}
|
|
234
226
|
|
|
235
|
-
get onDidChangeBadge(): Event<void> {
|
|
236
|
-
return this.onDidChangeBadgeEmitter.event;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
get onDidChangeBadgeTooltip(): Event<void> {
|
|
240
|
-
return this.onDidChangeBadgeTooltipEmitter.event;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
get badge(): number | undefined {
|
|
244
|
-
return this._badge;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
set badge(badge: number | undefined) {
|
|
248
|
-
this._badge = badge;
|
|
249
|
-
this.onDidChangeBadgeEmitter.fire();
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
get badgeTooltip(): string | undefined {
|
|
253
|
-
return this._badgeTooltip;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
set badgeTooltip(badgeTooltip: string | undefined) {
|
|
257
|
-
this._badgeTooltip = badgeTooltip;
|
|
258
|
-
this.onDidChangeBadgeTooltipEmitter.fire();
|
|
259
|
-
}
|
|
260
|
-
|
|
261
227
|
protected override onBeforeAttach(msg: Message): void {
|
|
262
228
|
super.onBeforeAttach(msg);
|
|
263
229
|
this.doShow();
|
|
@@ -26,9 +26,10 @@ import { Disposable, DisposableCollection, ILogger } from '@theia/core';
|
|
|
26
26
|
import { WebviewView } from './webview-views';
|
|
27
27
|
import { CancellationToken } from '@theia/core/lib/common/cancellation';
|
|
28
28
|
import { WebviewsMainImpl } from '../webviews-main';
|
|
29
|
-
import { Widget, WidgetManager } from '@theia/core/lib/browser';
|
|
29
|
+
import { BadgeService, Widget, WidgetManager } from '@theia/core/lib/browser';
|
|
30
30
|
import { PluginViewRegistry } from '../view/plugin-view-registry';
|
|
31
31
|
import { ViewBadge } from '@theia/plugin';
|
|
32
|
+
import { PluginViewWidget } from '../view/plugin-view-widget';
|
|
32
33
|
|
|
33
34
|
export class WebviewViewsMainImpl implements WebviewViewsMain, Disposable {
|
|
34
35
|
|
|
@@ -41,6 +42,7 @@ export class WebviewViewsMainImpl implements WebviewViewsMain, Disposable {
|
|
|
41
42
|
protected readonly webviewViewProviders = new Map<string, Disposable>();
|
|
42
43
|
protected readonly widgetManager: WidgetManager;
|
|
43
44
|
protected readonly pluginViewRegistry: PluginViewRegistry;
|
|
45
|
+
protected readonly badgeService: BadgeService;
|
|
44
46
|
|
|
45
47
|
@inject(ILogger)
|
|
46
48
|
protected readonly logger: ILogger;
|
|
@@ -52,6 +54,7 @@ export class WebviewViewsMainImpl implements WebviewViewsMain, Disposable {
|
|
|
52
54
|
this.proxy = rpc.getProxy(MAIN_RPC_CONTEXT.WEBVIEW_VIEWS_EXT);
|
|
53
55
|
this.widgetManager = container.get(WidgetManager);
|
|
54
56
|
this.pluginViewRegistry = container.get(PluginViewRegistry);
|
|
57
|
+
this.badgeService = container.get(BadgeService);
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
dispose(): void {
|
|
@@ -133,8 +136,10 @@ export class WebviewViewsMainImpl implements WebviewViewsMain, Disposable {
|
|
|
133
136
|
async $setBadge(handle: string, badge: ViewBadge | undefined): Promise<void> {
|
|
134
137
|
const webviewView = this.getWebviewView(handle);
|
|
135
138
|
if (webviewView) {
|
|
136
|
-
webviewView.
|
|
137
|
-
|
|
139
|
+
if (!(webviewView.webview.parent instanceof PluginViewWidget)) {
|
|
140
|
+
throw new Error('Unexpected parent of WebviewViewWidget');
|
|
141
|
+
}
|
|
142
|
+
this.badgeService.showBadge(webviewView.webview.parent, badge);
|
|
138
143
|
}
|
|
139
144
|
}
|
|
140
145
|
|
|
@@ -25,13 +25,9 @@ import { WebviewWidget } from '../webview/webview';
|
|
|
25
25
|
export interface WebviewView {
|
|
26
26
|
title?: string;
|
|
27
27
|
description?: string;
|
|
28
|
-
badge?: number | undefined;
|
|
29
|
-
badgeTooltip?: string | undefined;
|
|
30
28
|
readonly webview: WebviewWidget;
|
|
31
29
|
readonly onDidChangeVisibility: Event<boolean>;
|
|
32
30
|
readonly onDidDispose: Event<void>;
|
|
33
|
-
readonly onDidChangeBadge: Event<void>;
|
|
34
|
-
readonly onDidChangeBadgeTooltip: Event<void>;
|
|
35
31
|
|
|
36
32
|
dispose(): void;
|
|
37
33
|
show(preserveFocus: boolean): void;
|
|
@@ -19,7 +19,7 @@ import { URI } from '@theia/core/shared/vscode-uri';
|
|
|
19
19
|
import { interfaces } from '@theia/core/shared/inversify';
|
|
20
20
|
import { WebviewsMain, MAIN_RPC_CONTEXT, WebviewsExt, WebviewPanelViewState } from '../../common/plugin-api-rpc';
|
|
21
21
|
import { RPCProtocol } from '../../common/rpc-protocol';
|
|
22
|
-
import {
|
|
22
|
+
import { WebviewOptions, WebviewPanelOptions, WebviewPanelShowOptions } from '@theia/plugin';
|
|
23
23
|
import { ApplicationShell } from '@theia/core/lib/browser/shell/application-shell';
|
|
24
24
|
import { WebviewWidget, WebviewWidgetIdentifier } from './webview/webview';
|
|
25
25
|
import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
@@ -160,14 +160,6 @@ export class WebviewsMainImpl implements WebviewsMain, Disposable {
|
|
|
160
160
|
webview.title.label = value;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
async $setBadge(handle: string, badge: ViewBadge | undefined): Promise<void> {
|
|
164
|
-
const webview = await this.getWebview(handle);
|
|
165
|
-
if (webview) {
|
|
166
|
-
webview.badge = badge?.value;
|
|
167
|
-
webview.badgeTooltip = badge?.tooltip;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
163
|
async $setIconPath(handle: string, iconUrl: IconUrl | undefined): Promise<void> {
|
|
172
164
|
const webview = await this.getWebview(handle);
|
|
173
165
|
webview.setIconUrl(iconUrl);
|
|
@@ -126,6 +126,7 @@ export class AuthenticationExtImpl implements AuthenticationExt {
|
|
|
126
126
|
return sessions.map(session => ({
|
|
127
127
|
id: session.id,
|
|
128
128
|
accessToken: session.accessToken,
|
|
129
|
+
idToken: session.idToken,
|
|
129
130
|
account: { id: session.account.id, label: session.account.label },
|
|
130
131
|
scopes: session.scopes
|
|
131
132
|
}));
|
package/src/plugin/languages.ts
CHANGED
|
@@ -850,19 +850,16 @@ export class LanguagesExtImpl implements LanguagesExt {
|
|
|
850
850
|
|
|
851
851
|
registerDocumentSemanticTokensProvider(selector: theia.DocumentSelector, provider: theia.DocumentSemanticTokensProvider, legend: theia.SemanticTokensLegend,
|
|
852
852
|
pluginInfo: PluginInfo): theia.Disposable {
|
|
853
|
-
const eventHandle = (typeof provider.onDidChangeSemanticTokens === 'function' ? this.nextCallId() : undefined);
|
|
854
|
-
|
|
855
853
|
const handle = this.addNewAdapter(new DocumentSemanticTokensAdapter(this.documents, provider));
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
result = Disposable.from(result, subscription);
|
|
854
|
+
const unregister = this.createDisposable(handle);
|
|
855
|
+
if (typeof provider.onDidChangeSemanticTokens === 'function') {
|
|
856
|
+
const eventHandle = this.nextCallId();
|
|
857
|
+
const subscription = provider.onDidChangeSemanticTokens!(_ => this.proxy.$emitDocumentSemanticTokensEvent(handle));
|
|
858
|
+
this.proxy.$registerDocumentSemanticTokensProvider(handle, pluginInfo, this.transformDocumentSelector(selector), legend, eventHandle);
|
|
859
|
+
return Disposable.from(unregister, subscription);
|
|
863
860
|
}
|
|
864
|
-
|
|
865
|
-
return
|
|
861
|
+
this.proxy.$registerDocumentSemanticTokensProvider(handle, pluginInfo, this.transformDocumentSelector(selector), legend, undefined);
|
|
862
|
+
return unregister;
|
|
866
863
|
}
|
|
867
864
|
|
|
868
865
|
$provideDocumentSemanticTokens(handle: number, resource: UriComponents, previousResultId: number, token: theia.CancellationToken): Promise<BinaryBuffer | null> {
|
|
@@ -876,8 +873,15 @@ export class LanguagesExtImpl implements LanguagesExt {
|
|
|
876
873
|
registerDocumentRangeSemanticTokensProvider(selector: theia.DocumentSelector, provider: theia.DocumentRangeSemanticTokensProvider,
|
|
877
874
|
legend: theia.SemanticTokensLegend, pluginInfo: PluginInfo): theia.Disposable {
|
|
878
875
|
const handle = this.addNewAdapter(new DocumentRangeSemanticTokensAdapter(this.documents, provider));
|
|
879
|
-
|
|
880
|
-
|
|
876
|
+
const unregister = this.createDisposable(handle);
|
|
877
|
+
if (typeof provider.onDidChangeSemanticTokens === 'function') {
|
|
878
|
+
const eventHandle = this.nextCallId();
|
|
879
|
+
const subscription = provider.onDidChangeSemanticTokens!(_ => this.proxy.$emitDocumentSemanticTokensEvent(handle));
|
|
880
|
+
this.proxy.$registerDocumentRangeSemanticTokensProvider(handle, pluginInfo, this.transformDocumentSelector(selector), legend, eventHandle);
|
|
881
|
+
return Disposable.from(unregister, subscription);
|
|
882
|
+
}
|
|
883
|
+
this.proxy.$registerDocumentRangeSemanticTokensProvider(handle, pluginInfo, this.transformDocumentSelector(selector), legend, undefined);
|
|
884
|
+
return unregister;
|
|
881
885
|
}
|
|
882
886
|
|
|
883
887
|
$provideDocumentRangeSemanticTokens(handle: number, resource: UriComponents, range: Range, token: theia.CancellationToken): Promise<BinaryBuffer | null> {
|
|
@@ -227,6 +227,7 @@ import {
|
|
|
227
227
|
LanguageModelChatMessage,
|
|
228
228
|
LanguageModelChatMessageRole,
|
|
229
229
|
LanguageModelChatToolMode,
|
|
230
|
+
LanguageModelDataPart,
|
|
230
231
|
LanguageModelError,
|
|
231
232
|
LanguageModelPromptTsxPart,
|
|
232
233
|
LanguageModelTextPart,
|
|
@@ -237,6 +238,7 @@ import {
|
|
|
237
238
|
PortAttributes,
|
|
238
239
|
DebugVisualization,
|
|
239
240
|
TerminalShellExecutionCommandLineConfidence,
|
|
241
|
+
TerminalCompletionItem,
|
|
240
242
|
TerminalCompletionItemKind,
|
|
241
243
|
TerminalCompletionList,
|
|
242
244
|
McpHttpServerDefinition,
|
|
@@ -686,7 +688,7 @@ export function createAPIFactory(
|
|
|
686
688
|
},
|
|
687
689
|
/** @stubbed TerminalCompletionProvider */
|
|
688
690
|
registerTerminalCompletionProvider<T extends theia.TerminalCompletionItem>(
|
|
689
|
-
|
|
691
|
+
provider: theia.TerminalCompletionProvider<T>, ...triggerCharacters: string[]): Disposable {
|
|
690
692
|
return Disposable.NULL;
|
|
691
693
|
},
|
|
692
694
|
/** @stubbed TerminalQuickFixProvider */
|
|
@@ -1607,6 +1609,7 @@ export function createAPIFactory(
|
|
|
1607
1609
|
ChatResultFeedbackKind,
|
|
1608
1610
|
LanguageModelChatMessage,
|
|
1609
1611
|
LanguageModelChatMessageRole,
|
|
1612
|
+
LanguageModelDataPart,
|
|
1610
1613
|
LanguageModelError,
|
|
1611
1614
|
LanguageModelChatToolMode,
|
|
1612
1615
|
LanguageModelPromptTsxPart,
|
|
@@ -1618,6 +1621,7 @@ export function createAPIFactory(
|
|
|
1618
1621
|
PortAttributes,
|
|
1619
1622
|
DebugVisualization,
|
|
1620
1623
|
TerminalShellExecutionCommandLineConfidence,
|
|
1624
|
+
TerminalCompletionItem,
|
|
1621
1625
|
TerminalCompletionItemKind,
|
|
1622
1626
|
TerminalCompletionList,
|
|
1623
1627
|
McpHttpServerDefinition,
|
package/src/plugin/timeline.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
import { Plugin, PLUGIN_RPC_CONTEXT, TimelineCommandArg, TimelineExt, TimelineMain } from '../common';
|
|
17
17
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
18
|
-
import { Disposable, URI } from './types-impl';
|
|
18
|
+
import { Disposable, ThemeIcon, URI } from './types-impl';
|
|
19
19
|
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
20
20
|
import { CommandRegistryImpl } from './command-registry';
|
|
21
21
|
import type {
|
|
@@ -28,6 +28,8 @@ import type {
|
|
|
28
28
|
import * as theia from '@theia/plugin';
|
|
29
29
|
import { CancellationToken } from '@theia/core/lib/common/cancellation';
|
|
30
30
|
import { UriComponents } from '../common/uri-components';
|
|
31
|
+
import { convertIconPath } from './type-converters';
|
|
32
|
+
import { PluginIconPath } from './plugin-icon-path';
|
|
31
33
|
|
|
32
34
|
/*---------------------------------------------------------------------------------------------
|
|
33
35
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -65,7 +67,7 @@ export class TimelineExtImpl implements TimelineExt {
|
|
|
65
67
|
registerTimelineProvider(plugin: Plugin, scheme: string | string[], provider: theia.TimelineProvider): Disposable {
|
|
66
68
|
const timelineDisposables = new DisposableCollection();
|
|
67
69
|
|
|
68
|
-
const convertTimelineItem = this.convertTimelineItem(provider.id, timelineDisposables).bind(this);
|
|
70
|
+
const convertTimelineItem = this.convertTimelineItem(plugin, provider.id, timelineDisposables).bind(this);
|
|
69
71
|
|
|
70
72
|
let disposable: Disposable | undefined;
|
|
71
73
|
if (provider.onDidChange) {
|
|
@@ -115,7 +117,8 @@ export class TimelineExtImpl implements TimelineExt {
|
|
|
115
117
|
});
|
|
116
118
|
}
|
|
117
119
|
|
|
118
|
-
private convertTimelineItem(source: string, disposables: DisposableCollection):
|
|
120
|
+
private convertTimelineItem(plugin: Plugin, source: string, disposables: DisposableCollection):
|
|
121
|
+
(uri: URI, options?: InternalTimelineOptions) => (item: theia.TimelineItem) => TimelineItem {
|
|
119
122
|
return (uri: URI, options?: InternalTimelineOptions) => {
|
|
120
123
|
let items: Map<string, theia.TimelineItem> | undefined;
|
|
121
124
|
if (options?.cacheResults) {
|
|
@@ -148,6 +151,7 @@ export class TimelineExtImpl implements TimelineExt {
|
|
|
148
151
|
handle: handle,
|
|
149
152
|
source: source,
|
|
150
153
|
command: item.command ? this.commands.converter.toSafeCommand(item.command, disposables) : undefined,
|
|
154
|
+
icon: ThemeIcon.get(iconPath) ?? PluginIconPath.toUrl(convertIconPath(iconPath), plugin)
|
|
151
155
|
};
|
|
152
156
|
};
|
|
153
157
|
};
|
package/src/plugin/types-impl.ts
CHANGED
|
@@ -33,6 +33,7 @@ import * as paths from 'path';
|
|
|
33
33
|
import { es5ClassCompat } from '../common/types';
|
|
34
34
|
import { isObject, isStringArray } from '@theia/core/lib/common';
|
|
35
35
|
import { CellEditType, CellMetadataEdit, NotebookDocumentMetadataEdit } from '@theia/notebook/lib/common';
|
|
36
|
+
import { BinaryBuffer } from '@theia/core/lib/common/buffer';
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* This is an implementation of #theia.Uri based on vscode-uri.
|
|
@@ -3445,9 +3446,10 @@ export class TimelineItem {
|
|
|
3445
3446
|
id?: string;
|
|
3446
3447
|
iconPath?: theia.Uri | { light: theia.Uri; dark: theia.Uri } | ThemeIcon;
|
|
3447
3448
|
description?: string;
|
|
3448
|
-
|
|
3449
|
+
tooltip?: string | theia.MarkdownString | undefined;
|
|
3449
3450
|
command?: theia.Command;
|
|
3450
3451
|
contextValue?: string;
|
|
3452
|
+
accessibilityInformation?: AccessibilityInformation;
|
|
3451
3453
|
constructor(label: string, timestamp: number) {
|
|
3452
3454
|
this.label = label;
|
|
3453
3455
|
this.timestamp = timestamp;
|
|
@@ -3850,7 +3852,7 @@ export enum EditSessionIdentityMatch {
|
|
|
3850
3852
|
// #region terminalCompletionProvider
|
|
3851
3853
|
export class TerminalCompletionList<T extends theia.TerminalCompletionItem> {
|
|
3852
3854
|
|
|
3853
|
-
|
|
3855
|
+
resourceOptions?: theia.TerminalCompletionResourceOptions;
|
|
3854
3856
|
|
|
3855
3857
|
items: T[];
|
|
3856
3858
|
|
|
@@ -3858,13 +3860,28 @@ export class TerminalCompletionList<T extends theia.TerminalCompletionItem> {
|
|
|
3858
3860
|
* Creates a new completion list.
|
|
3859
3861
|
*
|
|
3860
3862
|
* @param items The completion items.
|
|
3861
|
-
* @param
|
|
3862
|
-
* @stubbed
|
|
3863
|
+
* @param resourceOptions Indicates which resources should be shown as completions for the cwd of the terminal.
|
|
3863
3864
|
*/
|
|
3864
|
-
constructor(items
|
|
3865
|
+
constructor(items: T[], resourceOptions?: theia.TerminalCompletionResourceOptions) {
|
|
3865
3866
|
}
|
|
3866
3867
|
}
|
|
3867
3868
|
|
|
3869
|
+
export class TerminalCompletionItem {
|
|
3870
|
+
label: string | theia.CompletionItemLabel;
|
|
3871
|
+
replacementRange: readonly [number, number];
|
|
3872
|
+
detail?: string;
|
|
3873
|
+
documentation?: string | theia.MarkdownString;
|
|
3874
|
+
kind?: TerminalCompletionItemKind;
|
|
3875
|
+
/**
|
|
3876
|
+
* @stubbed
|
|
3877
|
+
*/
|
|
3878
|
+
constructor(
|
|
3879
|
+
label: string | theia.CompletionItemLabel,
|
|
3880
|
+
replacementRange: readonly [number, number],
|
|
3881
|
+
kind?: TerminalCompletionItemKind
|
|
3882
|
+
) { }
|
|
3883
|
+
}
|
|
3884
|
+
|
|
3868
3885
|
export enum TerminalCompletionItemKind {
|
|
3869
3886
|
File = 0,
|
|
3870
3887
|
Folder = 1,
|
|
@@ -3876,11 +3893,11 @@ export enum TerminalCompletionItemKind {
|
|
|
3876
3893
|
Flag = 7,
|
|
3877
3894
|
SymbolicLinkFile = 8,
|
|
3878
3895
|
SymbolicLinkFolder = 9,
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3896
|
+
ScmCommit = 10,
|
|
3897
|
+
ScmBranch = 11,
|
|
3898
|
+
ScmTag = 12,
|
|
3899
|
+
ScmStash = 13,
|
|
3900
|
+
ScmRemote = 14,
|
|
3884
3901
|
PullRequest = 15,
|
|
3885
3902
|
PullRequestDone = 16,
|
|
3886
3903
|
}
|
|
@@ -4021,11 +4038,11 @@ export enum LanguageModelChatMessageRole {
|
|
|
4021
4038
|
* @stubbed
|
|
4022
4039
|
*/
|
|
4023
4040
|
export class LanguageModelChatMessage {
|
|
4024
|
-
static User(content: string |
|
|
4041
|
+
static User(content: string | Array<LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelDataPart>, name?: string): LanguageModelChatMessage {
|
|
4025
4042
|
return new LanguageModelChatMessage(LanguageModelChatMessageRole.User, content, name);
|
|
4026
4043
|
}
|
|
4027
4044
|
|
|
4028
|
-
static Assistant(content: string | (LanguageModelTextPart | LanguageModelToolResultPart)[], name?: string): LanguageModelChatMessage {
|
|
4045
|
+
static Assistant(content: string | (LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelDataPart)[], name?: string): LanguageModelChatMessage {
|
|
4029
4046
|
return new LanguageModelChatMessage(LanguageModelChatMessageRole.Assistant, content, name);
|
|
4030
4047
|
}
|
|
4031
4048
|
|
|
@@ -4036,12 +4053,12 @@ export class LanguageModelChatMessage {
|
|
|
4036
4053
|
/**
|
|
4037
4054
|
* The various message types which a {@linkcode LanguageModelChatProvider} can emit in the chat response stream
|
|
4038
4055
|
*/
|
|
4039
|
-
export type LanguageModelResponsePart = LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart;
|
|
4056
|
+
export type LanguageModelResponsePart = LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart | LanguageModelDataPart;
|
|
4040
4057
|
|
|
4041
4058
|
/**
|
|
4042
4059
|
* The various message types which can be sent via {@linkcode LanguageModelChat.sendRequest } and processed by a {@linkcode LanguageModelChatProvider}
|
|
4043
4060
|
*/
|
|
4044
|
-
export type LanguageModelInputPart = LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart;
|
|
4061
|
+
export type LanguageModelInputPart = LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart | LanguageModelDataPart;
|
|
4045
4062
|
|
|
4046
4063
|
export class LanguageModelError extends Error {
|
|
4047
4064
|
|
|
@@ -4087,9 +4104,9 @@ export class LanguageModelToolCallPart {
|
|
|
4087
4104
|
*/
|
|
4088
4105
|
export class LanguageModelToolResultPart {
|
|
4089
4106
|
callId: string;
|
|
4090
|
-
content:
|
|
4107
|
+
content: Array<LanguageModelTextPart | LanguageModelPromptTsxPart | LanguageModelDataPart | unknown>;
|
|
4091
4108
|
|
|
4092
|
-
constructor(callId: string, content:
|
|
4109
|
+
constructor(callId: string, content: Array<LanguageModelTextPart | LanguageModelPromptTsxPart | LanguageModelDataPart | unknown>) { }
|
|
4093
4110
|
}
|
|
4094
4111
|
|
|
4095
4112
|
/**
|
|
@@ -4104,9 +4121,9 @@ export class LanguageModelTextPart {
|
|
|
4104
4121
|
* @stubbed
|
|
4105
4122
|
*/
|
|
4106
4123
|
export class LanguageModelToolResult {
|
|
4107
|
-
content:
|
|
4124
|
+
content: Array<LanguageModelTextPart | LanguageModelPromptTsxPart | LanguageModelDataPart | unknown>;
|
|
4108
4125
|
|
|
4109
|
-
constructor(content:
|
|
4126
|
+
constructor(content: Array<LanguageModelTextPart | LanguageModelPromptTsxPart | LanguageModelDataPart | unknown>) { }
|
|
4110
4127
|
}
|
|
4111
4128
|
|
|
4112
4129
|
/**
|
|
@@ -4118,6 +4135,26 @@ export class LanguageModelPromptTsxPart {
|
|
|
4118
4135
|
constructor(value: unknown) { }
|
|
4119
4136
|
}
|
|
4120
4137
|
|
|
4138
|
+
/**
|
|
4139
|
+
* @stubbed
|
|
4140
|
+
*/
|
|
4141
|
+
export class LanguageModelDataPart {
|
|
4142
|
+
static image(data: Uint8Array, mime: string): LanguageModelDataPart {
|
|
4143
|
+
return new LanguageModelDataPart(data, mime);
|
|
4144
|
+
}
|
|
4145
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4146
|
+
static json(value: any, mime: string = 'text/x-json'): LanguageModelDataPart {
|
|
4147
|
+
const rawStr = JSON.stringify(value, undefined, '\t');
|
|
4148
|
+
return new LanguageModelDataPart(BinaryBuffer.fromString(rawStr).buffer, mime);
|
|
4149
|
+
}
|
|
4150
|
+
static text(value: string, mime: string = 'text/plain'): LanguageModelDataPart {
|
|
4151
|
+
return new LanguageModelDataPart(BinaryBuffer.fromString(value).buffer, mime);
|
|
4152
|
+
}
|
|
4153
|
+
mimeType: string;
|
|
4154
|
+
data: Uint8Array;
|
|
4155
|
+
constructor(data: Uint8Array, mimeType: string) { }
|
|
4156
|
+
}
|
|
4157
|
+
|
|
4121
4158
|
/**
|
|
4122
4159
|
* @stubbed
|
|
4123
4160
|
*/
|