@theia/core 1.55.1 → 1.57.0-next.112
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 +43 -39
- package/i18n/nls.cs.json +23 -18
- package/i18n/nls.de.json +23 -18
- package/i18n/nls.es.json +23 -18
- package/i18n/nls.fr.json +23 -18
- package/i18n/nls.hu.json +23 -18
- package/i18n/nls.it.json +23 -18
- package/i18n/nls.ja.json +23 -18
- package/i18n/nls.json +24 -19
- package/i18n/nls.ko.json +23 -18
- package/i18n/nls.pl.json +23 -18
- package/i18n/nls.pt-br.json +23 -18
- package/i18n/nls.ru.json +23 -18
- package/i18n/nls.tr.json +23 -18
- package/i18n/nls.zh-cn.json +23 -18
- package/i18n/nls.zh-tw.json +23 -18
- package/lib/browser/catalog.json +332 -44
- package/lib/browser/common-frontend-contribution.d.ts +1 -1
- package/lib/browser/common-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/common-frontend-contribution.js +24 -9
- package/lib/browser/common-frontend-contribution.js.map +1 -1
- package/lib/browser/dialogs.d.ts +3 -1
- package/lib/browser/dialogs.d.ts.map +1 -1
- package/lib/browser/dialogs.js +26 -2
- package/lib/browser/dialogs.js.map +1 -1
- package/lib/browser/frontend-application-module.d.ts.map +1 -1
- package/lib/browser/frontend-application-module.js +1 -0
- package/lib/browser/frontend-application-module.js.map +1 -1
- package/lib/browser/hover-service.d.ts.map +1 -1
- package/lib/browser/hover-service.js +12 -4
- package/lib/browser/hover-service.js.map +1 -1
- package/lib/browser/json-schema-store.d.ts +12 -1
- package/lib/browser/json-schema-store.d.ts.map +1 -1
- package/lib/browser/json-schema-store.js +31 -1
- package/lib/browser/json-schema-store.js.map +1 -1
- package/lib/browser/keybinding.js +3 -3
- package/lib/browser/keybinding.js.map +1 -1
- package/lib/browser/progress-status-bar-item.d.ts +1 -1
- package/lib/browser/progress-status-bar-item.d.ts.map +1 -1
- package/lib/browser/saveable.d.ts +1 -0
- package/lib/browser/saveable.d.ts.map +1 -1
- package/lib/browser/saveable.js +3 -0
- package/lib/browser/saveable.js.map +1 -1
- package/lib/browser/secondary-window-handler.d.ts.map +1 -1
- package/lib/browser/secondary-window-handler.js +1 -0
- package/lib/browser/secondary-window-handler.js.map +1 -1
- package/lib/browser/shell/application-shell.d.ts +2 -1
- package/lib/browser/shell/application-shell.d.ts.map +1 -1
- package/lib/browser/shell/application-shell.js +24 -10
- package/lib/browser/shell/application-shell.js.map +1 -1
- package/lib/browser/shell/view-contribution.d.ts.map +1 -1
- package/lib/browser/shell/view-contribution.js +1 -0
- package/lib/browser/shell/view-contribution.js.map +1 -1
- package/lib/browser/test/jsdom.d.ts.map +1 -1
- package/lib/browser/test/jsdom.js +6 -1
- package/lib/browser/test/jsdom.js.map +1 -1
- package/lib/browser/tree/tree-decorator.d.ts.map +1 -1
- package/lib/browser/tree/tree-decorator.js +1 -0
- package/lib/browser/tree/tree-decorator.js.map +1 -1
- package/lib/browser/tree/tree-view-welcome-widget.d.ts +17 -11
- package/lib/browser/tree/tree-view-welcome-widget.d.ts.map +1 -1
- package/lib/browser/tree/tree-view-welcome-widget.js +65 -34
- package/lib/browser/tree/tree-view-welcome-widget.js.map +1 -1
- package/lib/browser/tree/tree-widget.d.ts +6 -2
- package/lib/browser/tree/tree-widget.d.ts.map +1 -1
- package/lib/browser/tree/tree-widget.js +4 -4
- package/lib/browser/tree/tree-widget.js.map +1 -1
- package/lib/browser/widgets/select-component.js +1 -1
- package/lib/browser/widgets/select-component.js.map +1 -1
- package/lib/browser/widgets/widget.d.ts +1 -1
- package/lib/browser/widgets/widget.d.ts.map +1 -1
- package/lib/browser/widgets/widget.js +21 -6
- package/lib/browser/widgets/widget.js.map +1 -1
- package/lib/browser/window/browser-window-module.d.ts.map +1 -1
- package/lib/browser/window/browser-window-module.js +3 -0
- package/lib/browser/window/browser-window-module.js.map +1 -1
- package/lib/browser/window/default-secondary-window-service.d.ts +5 -0
- package/lib/browser/window/default-secondary-window-service.d.ts.map +1 -1
- package/lib/browser/window/default-secondary-window-service.js +6 -0
- package/lib/browser/window/default-secondary-window-service.js.map +1 -1
- package/lib/browser/window/secondary-window-service.d.ts +3 -0
- package/lib/browser/window/secondary-window-service.d.ts.map +1 -1
- package/lib/browser/window/secondary-window-service.js.map +1 -1
- package/lib/browser/window/window-title-service.d.ts +6 -0
- package/lib/browser/window/window-title-service.d.ts.map +1 -1
- package/lib/browser/window/window-title-service.js +12 -1
- package/lib/browser/window/window-title-service.js.map +1 -1
- package/lib/common/encoding-service.d.ts +1 -0
- package/lib/common/encoding-service.d.ts.map +1 -1
- package/lib/common/performance/stopwatch.d.ts.map +1 -1
- package/lib/common/performance/stopwatch.js +1 -0
- package/lib/common/performance/stopwatch.js.map +1 -1
- package/lib/common/resource.d.ts +2 -0
- package/lib/common/resource.d.ts.map +1 -1
- package/lib/common/resource.js +1 -0
- package/lib/common/resource.js.map +1 -1
- package/lib/common/theme.d.ts +1 -1
- package/lib/common/theme.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-context-menu-renderer.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-context-menu-renderer.js +10 -2
- package/lib/electron-browser/menu/electron-context-menu-renderer.js.map +1 -1
- package/lib/electron-browser/messaging/electron-local-ws-connection-source.d.ts +1 -0
- package/lib/electron-browser/messaging/electron-local-ws-connection-source.d.ts.map +1 -1
- package/lib/electron-browser/messaging/electron-local-ws-connection-source.js +7 -1
- package/lib/electron-browser/messaging/electron-local-ws-connection-source.js.map +1 -1
- package/lib/electron-browser/window/electron-window-module.d.ts.map +1 -1
- package/lib/electron-browser/window/electron-window-module.js +3 -0
- package/lib/electron-browser/window/electron-window-module.js.map +1 -1
- package/lib/electron-main/electron-main-application.d.ts.map +1 -1
- package/lib/electron-main/electron-main-application.js +16 -14
- package/lib/electron-main/electron-main-application.js.map +1 -1
- package/lib/electron-main/theia-electron-window.d.ts.map +1 -1
- package/lib/electron-main/theia-electron-window.js +11 -3
- package/lib/electron-main/theia-electron-window.js.map +1 -1
- package/lib/node/messaging/test/test-web-socket-channel.d.ts.map +1 -1
- package/lib/node/messaging/test/test-web-socket-channel.js +7 -1
- package/lib/node/messaging/test/test-web-socket-channel.js.map +1 -1
- package/lib/node/messaging/websocket-endpoint.d.ts +1 -1
- package/lib/node/messaging/websocket-endpoint.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/browser/common-frontend-contribution.ts +24 -9
- package/src/browser/dialogs.ts +28 -5
- package/src/browser/frontend-application-module.ts +2 -1
- package/src/browser/hover-service.ts +12 -5
- package/src/browser/json-schema-store.ts +35 -1
- package/src/browser/keybinding.ts +3 -3
- package/src/browser/saveable.ts +3 -0
- package/src/browser/secondary-window-handler.ts +1 -0
- package/src/browser/shell/application-shell.ts +27 -11
- package/src/browser/shell/view-contribution.ts +2 -2
- package/src/browser/style/dockpanel.css +10 -0
- package/src/browser/test/jsdom.ts +6 -1
- package/src/browser/tree/tree-decorator.ts +2 -2
- package/src/browser/tree/tree-view-welcome-widget.tsx +82 -46
- package/src/browser/tree/tree-widget.tsx +10 -4
- package/src/browser/widgets/select-component.tsx +1 -1
- package/src/browser/widgets/widget.ts +21 -6
- package/src/browser/window/browser-window-module.ts +3 -0
- package/src/browser/window/default-secondary-window-service.ts +7 -1
- package/src/browser/window/secondary-window-service.ts +3 -0
- package/src/browser/window/window-title-service.ts +14 -1
- package/src/common/performance/stopwatch.ts +2 -2
- package/src/common/resource.ts +4 -0
- package/src/common/theme.ts +1 -1
- package/src/electron-browser/menu/electron-context-menu-renderer.ts +10 -2
- package/src/electron-browser/messaging/electron-local-ws-connection-source.ts +5 -0
- package/src/electron-browser/window/electron-window-module.ts +3 -0
- package/src/electron-main/electron-main-application.ts +12 -11
- package/src/electron-main/theia-electron-window.ts +11 -3
- package/src/node/messaging/test/test-web-socket-channel.ts +6 -1
|
@@ -43,7 +43,12 @@ export function enableJSDOM(): () => void {
|
|
|
43
43
|
});
|
|
44
44
|
(global as any)['document'] = dom.window.document;
|
|
45
45
|
(global as any)['window'] = dom.window;
|
|
46
|
-
|
|
46
|
+
try {
|
|
47
|
+
(global as any)['navigator'] = { userAgent: 'node.js', platform: 'Mac' };
|
|
48
|
+
|
|
49
|
+
} catch (e) {
|
|
50
|
+
// node 21+ already has a navigator object
|
|
51
|
+
}
|
|
47
52
|
|
|
48
53
|
const toCleanup: string[] = [];
|
|
49
54
|
Object.getOwnPropertyNames((dom.window as any)).forEach(property => {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { injectable } from 'inversify';
|
|
17
|
+
import { injectable, unmanaged } from 'inversify';
|
|
18
18
|
import { Tree, TreeNode } from './tree';
|
|
19
19
|
import { Event, Emitter, Disposable, DisposableCollection, MaybePromise } from '../../common';
|
|
20
20
|
import { WidgetDecoration } from '../widget-decoration';
|
|
@@ -170,7 +170,7 @@ export abstract class AbstractTreeDecoratorService implements TreeDecoratorServi
|
|
|
170
170
|
|
|
171
171
|
protected readonly toDispose = new DisposableCollection();
|
|
172
172
|
|
|
173
|
-
constructor(protected readonly decorators: ReadonlyArray<TreeDecorator>) {
|
|
173
|
+
constructor(@unmanaged() protected readonly decorators: ReadonlyArray<TreeDecorator>) {
|
|
174
174
|
this.toDispose.push(this.onDidChangeDecorationsEmitter);
|
|
175
175
|
this.toDispose.pushAll(this.decorators.map(decorator =>
|
|
176
176
|
decorator.onDidChangeDecorations(data =>
|
|
@@ -19,28 +19,35 @@
|
|
|
19
19
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20
20
|
*--------------------------------------------------------------------------------------------*/
|
|
21
21
|
// some code is copied and modified from: https://github.com/microsoft/vscode/blob/573e5145ae3b50523925a6f6315d373e649d1b06/src/vs/base/common/linkedText.ts
|
|
22
|
+
// aligned the API and enablement behavior to https://github.com/microsoft/vscode/blob/c711bc9333ba339fde1a530de0094b3fa32f09de/src/vs/base/common/linkedText.ts
|
|
22
23
|
|
|
23
24
|
import React = require('react');
|
|
24
25
|
import { inject, injectable } from 'inversify';
|
|
25
|
-
import {
|
|
26
|
+
import { URI as CodeUri } from 'vscode-uri';
|
|
27
|
+
import { CommandRegistry, DisposableCollection } from '../../common';
|
|
28
|
+
import URI from '../../common/uri';
|
|
26
29
|
import { ContextKeyService } from '../context-key-service';
|
|
30
|
+
import { LabelIcon, LabelParser } from '../label-parser';
|
|
31
|
+
import { OpenerService, open } from '../opener-service';
|
|
32
|
+
import { codicon } from '../widgets';
|
|
33
|
+
import { WindowService } from '../window/window-service';
|
|
27
34
|
import { TreeModel } from './tree-model';
|
|
28
35
|
import { TreeWidget } from './tree-widget';
|
|
29
|
-
import { WindowService } from '../window/window-service';
|
|
30
36
|
|
|
31
|
-
interface ViewWelcome {
|
|
37
|
+
export interface ViewWelcome {
|
|
32
38
|
readonly view: string;
|
|
33
39
|
readonly content: string;
|
|
34
40
|
readonly when?: string;
|
|
41
|
+
readonly enablement?: string;
|
|
35
42
|
readonly order: number;
|
|
36
43
|
}
|
|
37
44
|
|
|
38
|
-
interface IItem {
|
|
45
|
+
export interface IItem {
|
|
39
46
|
readonly welcomeInfo: ViewWelcome;
|
|
40
47
|
visible: boolean;
|
|
41
48
|
}
|
|
42
49
|
|
|
43
|
-
interface ILink {
|
|
50
|
+
export interface ILink {
|
|
44
51
|
readonly label: string;
|
|
45
52
|
readonly href: string;
|
|
46
53
|
readonly title?: string;
|
|
@@ -60,6 +67,14 @@ export class TreeViewWelcomeWidget extends TreeWidget {
|
|
|
60
67
|
@inject(WindowService)
|
|
61
68
|
protected readonly windowService: WindowService;
|
|
62
69
|
|
|
70
|
+
@inject(LabelParser)
|
|
71
|
+
protected readonly labelParser: LabelParser;
|
|
72
|
+
|
|
73
|
+
@inject(OpenerService)
|
|
74
|
+
protected readonly openerService: OpenerService;
|
|
75
|
+
|
|
76
|
+
protected readonly toDisposeBeforeUpdateViewWelcomeNodes = new DisposableCollection();
|
|
77
|
+
|
|
63
78
|
protected viewWelcomeNodes: React.ReactNode[] = [];
|
|
64
79
|
protected defaultItem: IItem | undefined;
|
|
65
80
|
protected items: IItem[] = [];
|
|
@@ -130,13 +145,31 @@ export class TreeViewWelcomeWidget extends TreeWidget {
|
|
|
130
145
|
|
|
131
146
|
protected updateViewWelcomeNodes(): void {
|
|
132
147
|
this.viewWelcomeNodes = [];
|
|
148
|
+
this.toDisposeBeforeUpdateViewWelcomeNodes.dispose();
|
|
133
149
|
const items = this.visibleItems.sort((a, b) => a.order - b.order);
|
|
134
150
|
|
|
135
|
-
|
|
151
|
+
const enablementKeys: Set<string>[] = [];
|
|
152
|
+
// the plugin-view-registry will push the changes when there is a change in the `when` prop which controls the visibility
|
|
153
|
+
// this listener is to update the enablement of the components in the view welcome
|
|
154
|
+
this.toDisposeBeforeUpdateViewWelcomeNodes.push(
|
|
155
|
+
this.contextService.onDidChange(event => {
|
|
156
|
+
if (enablementKeys.some(keys => event.affects(keys))) {
|
|
157
|
+
this.updateViewWelcomeNodes();
|
|
158
|
+
this.update();
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
);
|
|
162
|
+
// Note: VS Code does not support the `renderSecondaryButtons` prop in welcome content either.
|
|
163
|
+
for (const { content, enablement } of items) {
|
|
164
|
+
const itemEnablementKeys = enablement
|
|
165
|
+
? this.contextService.parseKeys(enablement)
|
|
166
|
+
: undefined;
|
|
167
|
+
if (itemEnablementKeys) {
|
|
168
|
+
enablementKeys.push(itemEnablementKeys);
|
|
169
|
+
}
|
|
136
170
|
const lines = content.split('\n');
|
|
137
171
|
|
|
138
|
-
for (let
|
|
139
|
-
const lineKey = `${iIndex}-${lIndex}`;
|
|
172
|
+
for (let line of lines) {
|
|
140
173
|
line = line.trim();
|
|
141
174
|
|
|
142
175
|
if (!line) {
|
|
@@ -146,42 +179,35 @@ export class TreeViewWelcomeWidget extends TreeWidget {
|
|
|
146
179
|
const linkedTextItems = this.parseLinkedText(line);
|
|
147
180
|
|
|
148
181
|
if (linkedTextItems.length === 1 && typeof linkedTextItems[0] !== 'string') {
|
|
182
|
+
const node = linkedTextItems[0];
|
|
149
183
|
this.viewWelcomeNodes.push(
|
|
150
|
-
this.renderButtonNode(
|
|
184
|
+
this.renderButtonNode(
|
|
185
|
+
node,
|
|
186
|
+
this.viewWelcomeNodes.length,
|
|
187
|
+
enablement
|
|
188
|
+
)
|
|
151
189
|
);
|
|
152
190
|
} else {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const linkedTextKey = `${lineKey}-${nIndex}`;
|
|
157
|
-
|
|
158
|
-
if (typeof node === 'string') {
|
|
159
|
-
linkedTextNodes.push(
|
|
160
|
-
this.renderTextNode(node, linkedTextKey)
|
|
161
|
-
);
|
|
162
|
-
} else {
|
|
163
|
-
linkedTextNodes.push(
|
|
164
|
-
this.renderCommandLinkNode(node, linkedTextKey)
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
191
|
+
const renderNode = (item: LinkedTextItem, index: number) => typeof item == 'string'
|
|
192
|
+
? this.renderTextNode(item, index)
|
|
193
|
+
: this.renderLinkNode(item, index, enablement);
|
|
168
194
|
|
|
169
195
|
this.viewWelcomeNodes.push(
|
|
170
|
-
<
|
|
171
|
-
{...
|
|
172
|
-
</
|
|
196
|
+
<p key={`p-${this.viewWelcomeNodes.length}`}>
|
|
197
|
+
{...linkedTextItems.flatMap(renderNode)}
|
|
198
|
+
</p>
|
|
173
199
|
);
|
|
174
200
|
}
|
|
175
201
|
}
|
|
176
202
|
}
|
|
177
203
|
}
|
|
178
204
|
|
|
179
|
-
protected renderButtonNode(node: ILink, lineKey: string): React.ReactNode {
|
|
205
|
+
protected renderButtonNode(node: ILink, lineKey: string | number, enablement: string | undefined): React.ReactNode {
|
|
180
206
|
return (
|
|
181
207
|
<div key={`line-${lineKey}`} className='theia-WelcomeViewButtonWrapper'>
|
|
182
208
|
<button title={node.title}
|
|
183
209
|
className='theia-button theia-WelcomeViewButton'
|
|
184
|
-
disabled={!this.isEnabledClick(
|
|
210
|
+
disabled={!this.isEnabledClick(enablement)}
|
|
185
211
|
onClick={e => this.openLinkOrCommand(e, node.href)}>
|
|
186
212
|
{node.label}
|
|
187
213
|
</button>
|
|
@@ -189,14 +215,22 @@ export class TreeViewWelcomeWidget extends TreeWidget {
|
|
|
189
215
|
);
|
|
190
216
|
}
|
|
191
217
|
|
|
192
|
-
protected renderTextNode(node: string, textKey: string): React.ReactNode {
|
|
193
|
-
return <span key={`text-${textKey}`}>
|
|
218
|
+
protected renderTextNode(node: string, textKey: string | number): React.ReactNode {
|
|
219
|
+
return <span key={`text-${textKey}`}>
|
|
220
|
+
{this.labelParser.parse(node)
|
|
221
|
+
.map((segment, index) =>
|
|
222
|
+
LabelIcon.is(segment)
|
|
223
|
+
? <span
|
|
224
|
+
key={index}
|
|
225
|
+
className={codicon(segment.name)}
|
|
226
|
+
/>
|
|
227
|
+
: <span key={index}>{segment}</span>)}</span>;
|
|
194
228
|
}
|
|
195
229
|
|
|
196
|
-
protected
|
|
230
|
+
protected renderLinkNode(node: ILink, linkKey: string | number, enablement: string | undefined): React.ReactNode {
|
|
197
231
|
return (
|
|
198
232
|
<a key={`link-${linkKey}`}
|
|
199
|
-
className={this.getLinkClassName(node.href)}
|
|
233
|
+
className={this.getLinkClassName(node.href, enablement)}
|
|
200
234
|
title={node.title || ''}
|
|
201
235
|
onClick={e => this.openLinkOrCommand(e, node.href)}>
|
|
202
236
|
{node.label}
|
|
@@ -204,37 +238,39 @@ export class TreeViewWelcomeWidget extends TreeWidget {
|
|
|
204
238
|
);
|
|
205
239
|
}
|
|
206
240
|
|
|
207
|
-
protected getLinkClassName(href: string): string {
|
|
241
|
+
protected getLinkClassName(href: string, enablement: string | undefined): string {
|
|
208
242
|
const classNames = ['theia-WelcomeViewCommandLink'];
|
|
209
|
-
|
|
243
|
+
// Only command-backed links can be disabled. All other, https:, file: remain enabled
|
|
244
|
+
if (href.startsWith('command:') && !this.isEnabledClick(enablement)) {
|
|
210
245
|
classNames.push('disabled');
|
|
211
246
|
}
|
|
212
247
|
return classNames.join(' ');
|
|
213
248
|
}
|
|
214
249
|
|
|
215
|
-
protected isEnabledClick(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
return true;
|
|
250
|
+
protected isEnabledClick(enablement: string | undefined): boolean {
|
|
251
|
+
return typeof enablement === 'string'
|
|
252
|
+
? this.contextService.match(enablement)
|
|
253
|
+
: true;
|
|
221
254
|
}
|
|
222
255
|
|
|
223
|
-
protected openLinkOrCommand = (event: React.MouseEvent,
|
|
256
|
+
protected openLinkOrCommand = (event: React.MouseEvent, value: string): void => {
|
|
224
257
|
event.stopPropagation();
|
|
225
258
|
|
|
226
|
-
if (
|
|
227
|
-
const command =
|
|
259
|
+
if (value.startsWith('command:')) {
|
|
260
|
+
const command = value.replace('command:', '');
|
|
228
261
|
this.commands.executeCommand(command);
|
|
262
|
+
} else if (value.startsWith('file:')) {
|
|
263
|
+
const uri = value.replace('file:', '');
|
|
264
|
+
open(this.openerService, new URI(CodeUri.file(uri).toString()));
|
|
229
265
|
} else {
|
|
230
|
-
this.windowService.openNewWindow(
|
|
266
|
+
this.windowService.openNewWindow(value, { external: true });
|
|
231
267
|
}
|
|
232
268
|
};
|
|
233
269
|
|
|
234
270
|
protected parseLinkedText(text: string): LinkedTextItem[] {
|
|
235
271
|
const result: LinkedTextItem[] = [];
|
|
236
272
|
|
|
237
|
-
const linkRegex = /\[([^\]]+)\]\(((?:https?:\/\/|command:)[^\)\s]+)(?: ("
|
|
273
|
+
const linkRegex = /\[([^\]]+)\]\(((?:https?:\/\/|command:|file:)[^\)\s]+)(?: (["'])(.+?)(\3))?\)/gi;
|
|
238
274
|
let index = 0;
|
|
239
275
|
let match: RegExpExecArray | null;
|
|
240
276
|
|
|
@@ -32,7 +32,7 @@ import { notEmpty } from '../../common/objects';
|
|
|
32
32
|
import { isOSX } from '../../common/os';
|
|
33
33
|
import { ReactWidget } from '../widgets/react-widget';
|
|
34
34
|
import * as React from 'react';
|
|
35
|
-
import { Virtuoso, VirtuosoHandle } from 'react-virtuoso';
|
|
35
|
+
import { Virtuoso, VirtuosoHandle, VirtuosoProps } from 'react-virtuoso';
|
|
36
36
|
import { TopDownTreeIterator } from './tree-iterator';
|
|
37
37
|
import { SearchBox, SearchBoxFactory, SearchBoxProps } from './search-box';
|
|
38
38
|
import { TreeSearch } from './tree-search';
|
|
@@ -111,6 +111,10 @@ export interface TreeProps {
|
|
|
111
111
|
*/
|
|
112
112
|
readonly expandOnlyOnExpansionToggleClick?: boolean;
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Props that are forwarded to the virtuoso list rendered. Defaults to `{}`.
|
|
116
|
+
*/
|
|
117
|
+
readonly viewProps?: VirtuosoProps<unknown, unknown>;
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
/**
|
|
@@ -498,6 +502,7 @@ export class TreeWidget extends ReactWidget implements StatefulWidget {
|
|
|
498
502
|
rows={rows}
|
|
499
503
|
renderNodeRow={this.renderNodeRow}
|
|
500
504
|
scrollToRow={this.scrollToRow}
|
|
505
|
+
{...this.props.viewProps}
|
|
501
506
|
/>;
|
|
502
507
|
}
|
|
503
508
|
// eslint-disable-next-line no-null/no-null
|
|
@@ -1546,7 +1551,7 @@ export namespace TreeWidget {
|
|
|
1546
1551
|
/**
|
|
1547
1552
|
* Representation of the tree view properties.
|
|
1548
1553
|
*/
|
|
1549
|
-
export interface ViewProps {
|
|
1554
|
+
export interface ViewProps extends VirtuosoProps<unknown, unknown> {
|
|
1550
1555
|
/**
|
|
1551
1556
|
* The width property.
|
|
1552
1557
|
*/
|
|
@@ -1568,7 +1573,7 @@ export namespace TreeWidget {
|
|
|
1568
1573
|
export class View extends React.Component<ViewProps> {
|
|
1569
1574
|
list: VirtuosoHandle | undefined;
|
|
1570
1575
|
override render(): React.ReactNode {
|
|
1571
|
-
const { rows, width, height, scrollToRow } = this.props;
|
|
1576
|
+
const { rows, width, height, scrollToRow, renderNodeRow, ...other } = this.props;
|
|
1572
1577
|
return <Virtuoso
|
|
1573
1578
|
ref={list => {
|
|
1574
1579
|
this.list = (list || undefined);
|
|
@@ -1580,11 +1585,12 @@ export namespace TreeWidget {
|
|
|
1580
1585
|
}
|
|
1581
1586
|
}}
|
|
1582
1587
|
totalCount={rows.length}
|
|
1583
|
-
itemContent={index =>
|
|
1588
|
+
itemContent={index => renderNodeRow(rows[index])}
|
|
1584
1589
|
width={width}
|
|
1585
1590
|
height={height}
|
|
1586
1591
|
// This is a pixel value, it will scan 200px to the top and bottom of the current view
|
|
1587
1592
|
overscan={500}
|
|
1593
|
+
{...other}
|
|
1588
1594
|
/>;
|
|
1589
1595
|
}
|
|
1590
1596
|
}
|
|
@@ -325,7 +325,7 @@ export class SelectComponent extends React.Component<SelectComponentProps, Selec
|
|
|
325
325
|
|
|
326
326
|
return <div key="dropdown" className="theia-select-component-dropdown" style={{
|
|
327
327
|
top: invert ? 'none' : this.state.dimensions.bottom,
|
|
328
|
-
bottom: invert ? shellArea.top
|
|
328
|
+
bottom: invert ? shellArea.top - this.state.dimensions.top : 'none',
|
|
329
329
|
left: this.alignLeft ? this.state.dimensions.left : 'none',
|
|
330
330
|
right: this.alignLeft ? 'none' : shellArea.width - this.state.dimensions.right,
|
|
331
331
|
width: Math.min(Math.max(this.state.dimensions.width, this.optimalWidth), maxWidth),
|
|
@@ -24,6 +24,7 @@ import { KeyCode, KeysOrKeyCodes } from '../keyboard/keys';
|
|
|
24
24
|
|
|
25
25
|
import PerfectScrollbar from 'perfect-scrollbar';
|
|
26
26
|
import { PreviewableWidget } from '../widgets/previewable-widget';
|
|
27
|
+
import { Slot } from '@phosphor/signaling';
|
|
27
28
|
|
|
28
29
|
decorate(injectable(), Widget);
|
|
29
30
|
decorate(unmanaged(), Widget, 0);
|
|
@@ -116,7 +117,7 @@ export class BaseWidget extends Widget implements PreviewableWidget {
|
|
|
116
117
|
protected scrollBar?: PerfectScrollbar;
|
|
117
118
|
protected scrollOptions?: PerfectScrollbar.Options;
|
|
118
119
|
|
|
119
|
-
constructor(options?: Widget.IOptions) {
|
|
120
|
+
constructor(@unmanaged() options?: Widget.IOptions) {
|
|
120
121
|
super(options);
|
|
121
122
|
}
|
|
122
123
|
|
|
@@ -364,23 +365,37 @@ function waitForVisible(widget: Widget, visible: boolean, attached?: boolean): P
|
|
|
364
365
|
});
|
|
365
366
|
}
|
|
366
367
|
|
|
368
|
+
const pinnedTitles = new Map<Title<Widget>, [boolean, Slot<Widget, void>]>();
|
|
369
|
+
|
|
367
370
|
export function isPinned(title: Title<Widget>): boolean {
|
|
368
371
|
const pinnedState = !title.closable && title.className.includes(PINNED_CLASS);
|
|
369
372
|
return pinnedState;
|
|
370
373
|
}
|
|
371
374
|
|
|
372
|
-
export function unpin(title: Title<Widget>): void {
|
|
373
|
-
title.closable = true;
|
|
374
|
-
title.className = title.className.replace(PINNED_CLASS, '').trim();
|
|
375
|
-
}
|
|
376
|
-
|
|
377
375
|
export function pin(title: Title<Widget>): void {
|
|
376
|
+
const l = () => {
|
|
377
|
+
pinnedTitles.delete(title);
|
|
378
|
+
};
|
|
379
|
+
pinnedTitles.set(title, [title.closable, l]);
|
|
380
|
+
title.owner.disposed.connect(l);
|
|
378
381
|
title.closable = false;
|
|
379
382
|
if (!title.className.includes(PINNED_CLASS)) {
|
|
380
383
|
title.className += ` ${PINNED_CLASS}`;
|
|
381
384
|
}
|
|
382
385
|
}
|
|
383
386
|
|
|
387
|
+
export function unpin(title: Title<Widget>): void {
|
|
388
|
+
const entry = pinnedTitles.get(title);
|
|
389
|
+
if (entry) {
|
|
390
|
+
title.owner.disposed.disconnect(entry[1]);
|
|
391
|
+
title.closable = entry[0];
|
|
392
|
+
pinnedTitles.delete(title);
|
|
393
|
+
} else {
|
|
394
|
+
title.closable = true;
|
|
395
|
+
}
|
|
396
|
+
title.className = title.className.replace(PINNED_CLASS, '').trim();
|
|
397
|
+
}
|
|
398
|
+
|
|
384
399
|
export function isLocked(title: Title<Widget>): boolean {
|
|
385
400
|
return title.className.includes(LOCKED_CLASS);
|
|
386
401
|
}
|
|
@@ -22,6 +22,8 @@ import { ClipboardService } from '../clipboard-service';
|
|
|
22
22
|
import { BrowserClipboardService } from '../browser-clipboard-service';
|
|
23
23
|
import { SecondaryWindowService } from './secondary-window-service';
|
|
24
24
|
import { DefaultSecondaryWindowService } from './default-secondary-window-service';
|
|
25
|
+
import { bindContributionProvider } from '../../common';
|
|
26
|
+
import { WindowTitleContribution } from './window-title-service';
|
|
25
27
|
|
|
26
28
|
export default new ContainerModule(bind => {
|
|
27
29
|
bind(DefaultWindowService).toSelf().inSingletonScope();
|
|
@@ -29,4 +31,5 @@ export default new ContainerModule(bind => {
|
|
|
29
31
|
bind(FrontendApplicationContribution).toService(DefaultWindowService);
|
|
30
32
|
bind(ClipboardService).to(BrowserClipboardService).inSingletonScope();
|
|
31
33
|
bind(SecondaryWindowService).to(DefaultSecondaryWindowService).inSingletonScope();
|
|
34
|
+
bindContributionProvider(bind, WindowTitleContribution);
|
|
32
35
|
});
|
|
@@ -20,11 +20,15 @@ import { ExtractableWidget } from '../widgets';
|
|
|
20
20
|
import { ApplicationShell } from '../shell';
|
|
21
21
|
import { Saveable } from '../saveable';
|
|
22
22
|
import { PreferenceService } from '../preferences';
|
|
23
|
-
import { environment } from '../../common';
|
|
23
|
+
import { Emitter, environment, Event } from '../../common';
|
|
24
24
|
import { SaveableService } from '../saveable-service';
|
|
25
25
|
|
|
26
26
|
@injectable()
|
|
27
27
|
export class DefaultSecondaryWindowService implements SecondaryWindowService {
|
|
28
|
+
protected readonly onWindowOpenedEmitter = new Emitter<Window>;
|
|
29
|
+
readonly onWindowOpened: Event<Window> = this.onWindowOpenedEmitter.event;
|
|
30
|
+
protected readonly onWindowClosedEmitter = new Emitter<Window>;
|
|
31
|
+
readonly onWindowClosed: Event<Window> = this.onWindowClosedEmitter.event;
|
|
28
32
|
// secondary-window.html is part of Theia's generated code. It is generated by dev-packages/application-manager/src/generator/frontend-generator.ts
|
|
29
33
|
protected static SECONDARY_WINDOW_URL = 'secondary-window.html';
|
|
30
34
|
|
|
@@ -94,6 +98,7 @@ export class DefaultSecondaryWindowService implements SecondaryWindowService {
|
|
|
94
98
|
const newWindow = window.open(DefaultSecondaryWindowService.SECONDARY_WINDOW_URL, this.nextWindowId(), options) ?? undefined;
|
|
95
99
|
if (newWindow) {
|
|
96
100
|
this.secondaryWindows.push(newWindow);
|
|
101
|
+
this.onWindowOpenedEmitter.fire(newWindow);
|
|
97
102
|
newWindow.addEventListener('DOMContentLoaded', () => {
|
|
98
103
|
newWindow.addEventListener('beforeunload', evt => {
|
|
99
104
|
const saveable = Saveable.get(widget);
|
|
@@ -113,6 +118,7 @@ export class DefaultSecondaryWindowService implements SecondaryWindowService {
|
|
|
113
118
|
|
|
114
119
|
const extIndex = this.secondaryWindows.indexOf(newWindow);
|
|
115
120
|
if (extIndex > -1) {
|
|
121
|
+
this.onWindowClosedEmitter.fire(newWindow);
|
|
116
122
|
this.secondaryWindows.splice(extIndex, 1);
|
|
117
123
|
};
|
|
118
124
|
});
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
+
import { Event } from '../../common';
|
|
17
18
|
import { ApplicationShell } from '../shell';
|
|
18
19
|
import { ExtractableWidget } from '../widgets';
|
|
19
20
|
|
|
@@ -33,6 +34,8 @@ export interface SecondaryWindowService {
|
|
|
33
34
|
* @returns the created window or `undefined` if it could not be created
|
|
34
35
|
*/
|
|
35
36
|
createSecondaryWindow(widget: ExtractableWidget, shell: ApplicationShell): Window | undefined;
|
|
37
|
+
readonly onWindowOpened: Event<Window>;
|
|
38
|
+
readonly onWindowClosed: Event<Window>;
|
|
36
39
|
|
|
37
40
|
/** Handles focussing the given secondary window in the browser and on Electron. */
|
|
38
41
|
focus(win: Window): void;
|
|
@@ -14,11 +14,17 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { inject, injectable, postConstruct } from 'inversify';
|
|
17
|
+
import { inject, injectable, named, postConstruct } from 'inversify';
|
|
18
18
|
import { escapeRegExpCharacters } from '../../common/strings';
|
|
19
19
|
import { Emitter, Event } from '../../common/event';
|
|
20
20
|
import { CorePreferences } from '../core-preferences';
|
|
21
21
|
import { FrontendApplicationConfigProvider } from '../frontend-application-config-provider';
|
|
22
|
+
import { ContributionProvider } from '../../common';
|
|
23
|
+
|
|
24
|
+
export const WindowTitleContribution = Symbol('WindowTitleAddOnContribution');
|
|
25
|
+
export interface WindowTitleContribution {
|
|
26
|
+
enhanceTitle(title: string, parts: Map<string, string | undefined>): string;
|
|
27
|
+
}
|
|
22
28
|
|
|
23
29
|
export const InitialWindowTitleParts = {
|
|
24
30
|
activeEditorShort: undefined,
|
|
@@ -43,6 +49,9 @@ export class WindowTitleService {
|
|
|
43
49
|
@inject(CorePreferences)
|
|
44
50
|
protected readonly preferences: CorePreferences;
|
|
45
51
|
|
|
52
|
+
@inject(ContributionProvider) @named(WindowTitleContribution)
|
|
53
|
+
protected readonly titleContributions: ContributionProvider<WindowTitleContribution>;
|
|
54
|
+
|
|
46
55
|
protected _title = '';
|
|
47
56
|
protected titleTemplate?: string;
|
|
48
57
|
|
|
@@ -95,6 +104,10 @@ export class WindowTitleService {
|
|
|
95
104
|
}
|
|
96
105
|
const separatedTitle = title.split('${separator}').filter(e => e.trim().length > 0);
|
|
97
106
|
this._title = separatedTitle.join(this.separator);
|
|
107
|
+
const contributions = this.titleContributions.getContributions();
|
|
108
|
+
for (const contribution of contributions) {
|
|
109
|
+
this._title = contribution.enhanceTitle(this.title, this.titleParts);
|
|
110
|
+
}
|
|
98
111
|
}
|
|
99
112
|
const developmentHost = this.titleParts.get('developmentHost');
|
|
100
113
|
if (developmentHost) {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
18
|
|
|
19
|
-
import { inject, injectable } from 'inversify';
|
|
19
|
+
import { inject, injectable, unmanaged } from 'inversify';
|
|
20
20
|
import { ILogger, LogLevel } from '../logger';
|
|
21
21
|
import { MaybePromise } from '../types';
|
|
22
22
|
import { Measurement, MeasurementOptions, MeasurementResult } from './measurement';
|
|
@@ -58,7 +58,7 @@ export abstract class Stopwatch {
|
|
|
58
58
|
return this.onDidAddMeasurementResultEmitter.event;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
constructor(protected readonly defaultLogOptions: LogOptions) {
|
|
61
|
+
constructor(@unmanaged() protected readonly defaultLogOptions: LogOptions) {
|
|
62
62
|
if (!defaultLogOptions.defaultLogLevel) {
|
|
63
63
|
defaultLogOptions.defaultLogLevel = DEFAULT_LOG_LEVEL;
|
|
64
64
|
}
|
package/src/common/resource.ts
CHANGED
|
@@ -60,6 +60,8 @@ export interface Resource extends Disposable {
|
|
|
60
60
|
readonly onDidChangeReadOnly?: Event<boolean | MarkdownString>;
|
|
61
61
|
|
|
62
62
|
readonly readOnly?: boolean | MarkdownString;
|
|
63
|
+
|
|
64
|
+
readonly initiallyDirty?: boolean;
|
|
63
65
|
/**
|
|
64
66
|
* Reads latest content of this resource.
|
|
65
67
|
*
|
|
@@ -378,11 +380,13 @@ export class UntitledResourceResolver implements ResourceResolver {
|
|
|
378
380
|
export class UntitledResource implements Resource {
|
|
379
381
|
|
|
380
382
|
protected readonly onDidChangeContentsEmitter = new Emitter<void>();
|
|
383
|
+
initiallyDirty: boolean;
|
|
381
384
|
get onDidChangeContents(): Event<void> {
|
|
382
385
|
return this.onDidChangeContentsEmitter.event;
|
|
383
386
|
}
|
|
384
387
|
|
|
385
388
|
constructor(private resources: Map<string, UntitledResource>, public uri: URI, private content?: string) {
|
|
389
|
+
this.initiallyDirty = (content !== undefined && content.length > 0);
|
|
386
390
|
this.resources.set(this.uri.toString(), this);
|
|
387
391
|
}
|
|
388
392
|
|
package/src/common/theme.ts
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import { ElectronMainMenuFactory } from './electron-main-menu-factory';
|
|
24
24
|
import { ContextMenuContext } from '../../browser/menu/context-menu-context';
|
|
25
25
|
import { MenuPath, MenuContribution, MenuModelRegistry } from '../../common';
|
|
26
|
-
import { BrowserContextMenuRenderer } from '../../browser/menu/browser-context-menu-renderer';
|
|
26
|
+
import { BrowserContextMenuAccess, BrowserContextMenuRenderer } from '../../browser/menu/browser-context-menu-renderer';
|
|
27
27
|
|
|
28
28
|
export class ElectronContextMenuAccess extends ContextMenuAccess {
|
|
29
29
|
constructor(readonly menuHandle: Promise<number>) {
|
|
@@ -115,7 +115,15 @@ export class ElectronContextMenuRenderer extends BrowserContextMenuRenderer {
|
|
|
115
115
|
this.context.resetAltPressed();
|
|
116
116
|
return new ElectronContextMenuAccess(menuHandle);
|
|
117
117
|
} else {
|
|
118
|
-
|
|
118
|
+
const menuAccess = super.doRender(options);
|
|
119
|
+
const node = (menuAccess as BrowserContextMenuAccess).menu.node;
|
|
120
|
+
const topPanelHeight = document.getElementById('theia-top-panel')?.clientHeight ?? 0;
|
|
121
|
+
// ensure the context menu is not displayed outside of the main area
|
|
122
|
+
if (node.style.top && parseInt(node.style.top.substring(0, node.style.top.length - 2)) < topPanelHeight) {
|
|
123
|
+
node.style.top = `${topPanelHeight}px`;
|
|
124
|
+
node.style.maxHeight = `calc(${node.style.maxHeight} - ${topPanelHeight}px)`;
|
|
125
|
+
}
|
|
126
|
+
return menuAccess;
|
|
119
127
|
}
|
|
120
128
|
}
|
|
121
129
|
|
|
@@ -23,6 +23,11 @@ export function getLocalPort(): string | undefined {
|
|
|
23
23
|
return params.get('localPort') ?? undefined;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
export function getCurrentPort(): string | undefined {
|
|
27
|
+
const params = new URLSearchParams(location.search);
|
|
28
|
+
return params.get('port') ?? undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
@injectable()
|
|
27
32
|
export class ElectronLocalWebSocketConnectionSource extends WebSocketConnectionSource {
|
|
28
33
|
|
|
@@ -30,6 +30,8 @@ import { bindWindowPreferences } from './electron-window-preferences';
|
|
|
30
30
|
import { ElectronWindowService } from './electron-window-service';
|
|
31
31
|
import { ExternalAppOpenHandler } from './external-app-open-handler';
|
|
32
32
|
import { ElectronUriHandlerContribution } from '../electron-uri-handler';
|
|
33
|
+
import { bindContributionProvider } from '../../common';
|
|
34
|
+
import { WindowTitleContribution } from '../../browser/window/window-title-service';
|
|
33
35
|
|
|
34
36
|
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
35
37
|
bind(ElectronMainWindowService).toDynamicValue(context =>
|
|
@@ -45,4 +47,5 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
|
45
47
|
bind(SecondaryWindowService).to(ElectronSecondaryWindowService).inSingletonScope();
|
|
46
48
|
bind(ExternalAppOpenHandler).toSelf().inSingletonScope();
|
|
47
49
|
bind(OpenHandler).toService(ExternalAppOpenHandler);
|
|
50
|
+
bindContributionProvider(bind, WindowTitleContribution);
|
|
48
51
|
});
|