@theia/outline-view 1.48.1 → 1.48.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +30 -30
  2. package/lib/browser/index.d.ts +2 -2
  3. package/lib/browser/index.js +20 -20
  4. package/lib/browser/outline-breadcrumbs-contribution.d.ts +57 -57
  5. package/lib/browser/outline-breadcrumbs-contribution.js +214 -214
  6. package/lib/browser/outline-decorator-service.d.ts +13 -13
  7. package/lib/browser/outline-decorator-service.js +42 -42
  8. package/lib/browser/outline-view-contribution.d.ts +36 -36
  9. package/lib/browser/outline-view-contribution.js +125 -125
  10. package/lib/browser/outline-view-frontend-module.d.ts +4 -4
  11. package/lib/browser/outline-view-frontend-module.js +68 -68
  12. package/lib/browser/outline-view-service.d.ts +26 -26
  13. package/lib/browser/outline-view-service.js +78 -78
  14. package/lib/browser/outline-view-tree-model.d.ts +19 -19
  15. package/lib/browser/outline-view-tree-model.js +76 -76
  16. package/lib/browser/outline-view-widget.d.ts +76 -76
  17. package/lib/browser/outline-view-widget.js +184 -184
  18. package/lib/package.spec.js +25 -25
  19. package/package.json +4 -4
  20. package/src/browser/index.ts +18 -18
  21. package/src/browser/outline-breadcrumbs-contribution.tsx +229 -229
  22. package/src/browser/outline-decorator-service.ts +36 -36
  23. package/src/browser/outline-view-contribution.ts +132 -132
  24. package/src/browser/outline-view-frontend-module.ts +84 -84
  25. package/src/browser/outline-view-service.ts +82 -82
  26. package/src/browser/outline-view-tree-model.ts +77 -77
  27. package/src/browser/outline-view-widget.tsx +212 -212
  28. package/src/browser/styles/index.css +24 -24
  29. package/src/package.spec.ts +28 -28
@@ -1,77 +1,77 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2019 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { injectable } from '@theia/core/shared/inversify';
18
- import { CompositeTreeNode, TreeModelImpl, ExpandableTreeNode, TreeNode } from '@theia/core/lib/browser';
19
-
20
- @injectable()
21
- export class OutlineViewTreeModel extends TreeModelImpl {
22
-
23
- /**
24
- * Handle the expansion of the tree node.
25
- * - The method is a no-op in order to preserve focus on the editor
26
- * after attempting to perform a `collapse-all`.
27
- * @param node the expandable tree node.
28
- */
29
- protected override handleExpansion(node: Readonly<ExpandableTreeNode>): void {
30
- // no-op
31
- }
32
-
33
- override async collapseAll(raw?: Readonly<CompositeTreeNode>): Promise<boolean> {
34
- const node = raw || this.getFocusedNode();
35
- if (CompositeTreeNode.is(node)) {
36
- return this.expansionService.collapseAll(node);
37
- }
38
- return false;
39
- }
40
-
41
- /**
42
- * The default behavior of `openNode` calls `doOpenNode` which by default
43
- * toggles the expansion of the node. Overriding to prevent expansion, but
44
- * allow for the `onOpenNode` event to still fire on a double-click event.
45
- */
46
- override openNode(raw?: TreeNode | undefined): void {
47
- const node = raw || this.getFocusedNode();
48
- if (node) {
49
- this.onOpenNodeEmitter.fire(node);
50
- }
51
- }
52
-
53
- expandAll(raw?: TreeNode): void {
54
- if (CompositeTreeNode.is(raw)) {
55
- for (const child of raw.children) {
56
- if (ExpandableTreeNode.is(child)) {
57
- this.expandAll(child);
58
- }
59
- }
60
- }
61
- if (ExpandableTreeNode.is(raw)) {
62
- this.expandNode(raw);
63
- }
64
- }
65
-
66
- areNodesCollapsed(): boolean {
67
- if (CompositeTreeNode.is(this.root)) {
68
- for (const child of this.root.children) {
69
- if (!ExpandableTreeNode.isCollapsed(child)) {
70
- return false;
71
- }
72
- }
73
- }
74
- return true;
75
- }
76
-
77
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { injectable } from '@theia/core/shared/inversify';
18
+ import { CompositeTreeNode, TreeModelImpl, ExpandableTreeNode, TreeNode } from '@theia/core/lib/browser';
19
+
20
+ @injectable()
21
+ export class OutlineViewTreeModel extends TreeModelImpl {
22
+
23
+ /**
24
+ * Handle the expansion of the tree node.
25
+ * - The method is a no-op in order to preserve focus on the editor
26
+ * after attempting to perform a `collapse-all`.
27
+ * @param node the expandable tree node.
28
+ */
29
+ protected override handleExpansion(node: Readonly<ExpandableTreeNode>): void {
30
+ // no-op
31
+ }
32
+
33
+ override async collapseAll(raw?: Readonly<CompositeTreeNode>): Promise<boolean> {
34
+ const node = raw || this.getFocusedNode();
35
+ if (CompositeTreeNode.is(node)) {
36
+ return this.expansionService.collapseAll(node);
37
+ }
38
+ return false;
39
+ }
40
+
41
+ /**
42
+ * The default behavior of `openNode` calls `doOpenNode` which by default
43
+ * toggles the expansion of the node. Overriding to prevent expansion, but
44
+ * allow for the `onOpenNode` event to still fire on a double-click event.
45
+ */
46
+ override openNode(raw?: TreeNode | undefined): void {
47
+ const node = raw || this.getFocusedNode();
48
+ if (node) {
49
+ this.onOpenNodeEmitter.fire(node);
50
+ }
51
+ }
52
+
53
+ expandAll(raw?: TreeNode): void {
54
+ if (CompositeTreeNode.is(raw)) {
55
+ for (const child of raw.children) {
56
+ if (ExpandableTreeNode.is(child)) {
57
+ this.expandAll(child);
58
+ }
59
+ }
60
+ }
61
+ if (ExpandableTreeNode.is(raw)) {
62
+ this.expandNode(raw);
63
+ }
64
+ }
65
+
66
+ areNodesCollapsed(): boolean {
67
+ if (CompositeTreeNode.is(this.root)) {
68
+ for (const child of this.root.children) {
69
+ if (!ExpandableTreeNode.isCollapsed(child)) {
70
+ return false;
71
+ }
72
+ }
73
+ }
74
+ return true;
75
+ }
76
+
77
+ }
@@ -1,212 +1,212 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2017-2018 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-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
18
- import {
19
- TreeWidget,
20
- TreeNode,
21
- NodeProps,
22
- SelectableTreeNode,
23
- CompositeTreeNode,
24
- TreeProps,
25
- ContextMenuRenderer,
26
- TreeModel,
27
- ExpandableTreeNode,
28
- codicon
29
- } from '@theia/core/lib/browser';
30
- import { OutlineViewTreeModel } from './outline-view-tree-model';
31
- import { Message } from '@theia/core/shared/@phosphor/messaging';
32
- import { Emitter, Event, isObject, Mutable, UriSelection } from '@theia/core';
33
- import * as React from '@theia/core/shared/react';
34
- import { Range } from '@theia/core/shared/vscode-languageserver-protocol';
35
- import URI from '@theia/core/lib/common/uri';
36
- import { nls } from '@theia/core/lib/common/nls';
37
-
38
- /**
39
- * Representation of an outline symbol information node.
40
- */
41
- export interface OutlineSymbolInformationNode extends CompositeTreeNode, SelectableTreeNode, ExpandableTreeNode {
42
- /**
43
- * The `iconClass` for the given tree node.
44
- */
45
- iconClass: string;
46
- }
47
-
48
- /**
49
- * Collection of outline symbol information node functions.
50
- */
51
- export namespace OutlineSymbolInformationNode {
52
- /**
53
- * Determine if the given tree node is an `OutlineSymbolInformationNode`.
54
- * - The tree node is an `OutlineSymbolInformationNode` if:
55
- * - The node exists.
56
- * - The node is selectable.
57
- * - The node contains a defined `iconClass` property.
58
- * @param node the tree node.
59
- *
60
- * @returns `true` if the given node is an `OutlineSymbolInformationNode`.
61
- */
62
- export function is(node: TreeNode): node is OutlineSymbolInformationNode {
63
- return !!node && SelectableTreeNode.is(node) && 'iconClass' in node;
64
- }
65
-
66
- export function hasRange(node: unknown): node is { range: Range } {
67
- return isObject<{ range: Range }>(node) && Range.is(node.range);
68
- }
69
- }
70
-
71
- export type OutlineViewWidgetFactory = () => OutlineViewWidget;
72
- export const OutlineViewWidgetFactory = Symbol('OutlineViewWidgetFactory');
73
-
74
- @injectable()
75
- export class OutlineViewWidget extends TreeWidget {
76
-
77
- static LABEL = nls.localizeByDefault('Outline');
78
-
79
- readonly onDidChangeOpenStateEmitter = new Emitter<boolean>();
80
-
81
- protected readonly onDidUpdateEmitter = new Emitter<void>();
82
- readonly onDidUpdate: Event<void> = this.onDidUpdateEmitter.event;
83
-
84
- constructor(
85
- @inject(TreeProps) treeProps: TreeProps,
86
- @inject(OutlineViewTreeModel) override readonly model: OutlineViewTreeModel,
87
- @inject(ContextMenuRenderer) contextMenuRenderer: ContextMenuRenderer
88
- ) {
89
- super(treeProps, model, contextMenuRenderer);
90
-
91
- this.id = 'outline-view';
92
- this.title.label = OutlineViewWidget.LABEL;
93
- this.title.caption = OutlineViewWidget.LABEL;
94
- this.title.closable = true;
95
- this.title.iconClass = codicon('symbol-class');
96
- this.addClass('theia-outline-view');
97
- }
98
-
99
- @postConstruct()
100
- protected override init(): void {
101
- super.init();
102
- this.toDispose.push(this.model.onExpansionChanged(() => this.onDidUpdateEmitter.fire()));
103
- }
104
-
105
- /**
106
- * Set the outline tree with the list of `OutlineSymbolInformationNode`.
107
- * @param roots the list of `OutlineSymbolInformationNode`.
108
- */
109
- public setOutlineTree(roots: OutlineSymbolInformationNode[]): void {
110
- // Gather the list of available nodes.
111
- const nodes = this.reconcileTreeState(roots);
112
- // Update the model root node, appending the outline symbol information nodes as children.
113
- this.model.root = this.getRoot(nodes);
114
- }
115
-
116
- protected getRoot(children: TreeNode[]): CompositeTreeNode {
117
- return {
118
- id: 'outline-view-root',
119
- name: OutlineViewWidget.LABEL,
120
- visible: false,
121
- children,
122
- parent: undefined
123
- };
124
- }
125
-
126
- /**
127
- * Reconcile the outline tree state, gathering all available nodes.
128
- * @param nodes the list of `TreeNode`.
129
- *
130
- * @returns the list of tree nodes.
131
- */
132
- protected reconcileTreeState(nodes: TreeNode[]): TreeNode[] {
133
- nodes.forEach(node => {
134
- if (OutlineSymbolInformationNode.is(node)) {
135
- const treeNode = this.model.getNode(node.id);
136
- if (treeNode && OutlineSymbolInformationNode.is(treeNode)) {
137
- treeNode.expanded = node.expanded;
138
- treeNode.selected = node.selected;
139
- }
140
- this.reconcileTreeState(Array.from(node.children));
141
- }
142
- });
143
- return nodes;
144
- }
145
-
146
- protected override onAfterHide(msg: Message): void {
147
- super.onAfterHide(msg);
148
- this.onDidChangeOpenStateEmitter.fire(false);
149
- }
150
-
151
- protected override onAfterShow(msg: Message): void {
152
- super.onAfterShow(msg);
153
- this.onDidChangeOpenStateEmitter.fire(true);
154
- }
155
-
156
- override renderIcon(node: TreeNode, props: NodeProps): React.ReactNode {
157
- if (OutlineSymbolInformationNode.is(node)) {
158
- return <div className={'symbol-icon-center codicon codicon-symbol-' + node.iconClass}></div>;
159
- }
160
- return undefined;
161
- }
162
-
163
- protected override createNodeAttributes(node: TreeNode, props: NodeProps): React.Attributes & React.HTMLAttributes<HTMLElement> {
164
- const elementAttrs = super.createNodeAttributes(node, props);
165
- return {
166
- ...elementAttrs,
167
- title: this.getNodeTooltip(node)
168
- };
169
- }
170
-
171
- /**
172
- * Get the tooltip for the given tree node.
173
- * - The tooltip is discovered when hovering over a tree node.
174
- * - If available, the tooltip is the concatenation of the node name, and it's type.
175
- * @param node the tree node.
176
- *
177
- * @returns the tooltip for the tree node if available, else `undefined`.
178
- */
179
- protected getNodeTooltip(node: TreeNode): string | undefined {
180
- if (OutlineSymbolInformationNode.is(node)) {
181
- return node.name + ` (${node.iconClass})`;
182
- }
183
- return undefined;
184
- }
185
-
186
- protected override isExpandable(node: TreeNode): node is ExpandableTreeNode {
187
- return OutlineSymbolInformationNode.is(node) && node.children.length > 0;
188
- }
189
-
190
- protected override renderTree(model: TreeModel): React.ReactNode {
191
- if (CompositeTreeNode.is(this.model.root) && !this.model.root.children.length) {
192
- return <div className='theia-widget-noInfo no-outline'>{nls.localizeByDefault('The active editor cannot provide outline information.')}</div>;
193
- }
194
- return super.renderTree(model);
195
- }
196
-
197
- protected override deflateForStorage(node: TreeNode): object {
198
- const deflated = super.deflateForStorage(node) as { uri: string };
199
- if (UriSelection.is(node)) {
200
- deflated.uri = node.uri.toString();
201
- }
202
- return deflated;
203
- }
204
-
205
- protected override inflateFromStorage(node: any, parent?: TreeNode): TreeNode { /* eslint-disable-line @typescript-eslint/no-explicit-any */
206
- const inflated = super.inflateFromStorage(node, parent) as Mutable<TreeNode & UriSelection>;
207
- if (node && 'uri' in node && typeof node.uri === 'string') {
208
- inflated.uri = new URI(node.uri);
209
- }
210
- return inflated;
211
- }
212
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2017-2018 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-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
18
+ import {
19
+ TreeWidget,
20
+ TreeNode,
21
+ NodeProps,
22
+ SelectableTreeNode,
23
+ CompositeTreeNode,
24
+ TreeProps,
25
+ ContextMenuRenderer,
26
+ TreeModel,
27
+ ExpandableTreeNode,
28
+ codicon
29
+ } from '@theia/core/lib/browser';
30
+ import { OutlineViewTreeModel } from './outline-view-tree-model';
31
+ import { Message } from '@theia/core/shared/@phosphor/messaging';
32
+ import { Emitter, Event, isObject, Mutable, UriSelection } from '@theia/core';
33
+ import * as React from '@theia/core/shared/react';
34
+ import { Range } from '@theia/core/shared/vscode-languageserver-protocol';
35
+ import URI from '@theia/core/lib/common/uri';
36
+ import { nls } from '@theia/core/lib/common/nls';
37
+
38
+ /**
39
+ * Representation of an outline symbol information node.
40
+ */
41
+ export interface OutlineSymbolInformationNode extends CompositeTreeNode, SelectableTreeNode, ExpandableTreeNode {
42
+ /**
43
+ * The `iconClass` for the given tree node.
44
+ */
45
+ iconClass: string;
46
+ }
47
+
48
+ /**
49
+ * Collection of outline symbol information node functions.
50
+ */
51
+ export namespace OutlineSymbolInformationNode {
52
+ /**
53
+ * Determine if the given tree node is an `OutlineSymbolInformationNode`.
54
+ * - The tree node is an `OutlineSymbolInformationNode` if:
55
+ * - The node exists.
56
+ * - The node is selectable.
57
+ * - The node contains a defined `iconClass` property.
58
+ * @param node the tree node.
59
+ *
60
+ * @returns `true` if the given node is an `OutlineSymbolInformationNode`.
61
+ */
62
+ export function is(node: TreeNode): node is OutlineSymbolInformationNode {
63
+ return !!node && SelectableTreeNode.is(node) && 'iconClass' in node;
64
+ }
65
+
66
+ export function hasRange(node: unknown): node is { range: Range } {
67
+ return isObject<{ range: Range }>(node) && Range.is(node.range);
68
+ }
69
+ }
70
+
71
+ export type OutlineViewWidgetFactory = () => OutlineViewWidget;
72
+ export const OutlineViewWidgetFactory = Symbol('OutlineViewWidgetFactory');
73
+
74
+ @injectable()
75
+ export class OutlineViewWidget extends TreeWidget {
76
+
77
+ static LABEL = nls.localizeByDefault('Outline');
78
+
79
+ readonly onDidChangeOpenStateEmitter = new Emitter<boolean>();
80
+
81
+ protected readonly onDidUpdateEmitter = new Emitter<void>();
82
+ readonly onDidUpdate: Event<void> = this.onDidUpdateEmitter.event;
83
+
84
+ constructor(
85
+ @inject(TreeProps) treeProps: TreeProps,
86
+ @inject(OutlineViewTreeModel) override readonly model: OutlineViewTreeModel,
87
+ @inject(ContextMenuRenderer) contextMenuRenderer: ContextMenuRenderer
88
+ ) {
89
+ super(treeProps, model, contextMenuRenderer);
90
+
91
+ this.id = 'outline-view';
92
+ this.title.label = OutlineViewWidget.LABEL;
93
+ this.title.caption = OutlineViewWidget.LABEL;
94
+ this.title.closable = true;
95
+ this.title.iconClass = codicon('symbol-class');
96
+ this.addClass('theia-outline-view');
97
+ }
98
+
99
+ @postConstruct()
100
+ protected override init(): void {
101
+ super.init();
102
+ this.toDispose.push(this.model.onExpansionChanged(() => this.onDidUpdateEmitter.fire()));
103
+ }
104
+
105
+ /**
106
+ * Set the outline tree with the list of `OutlineSymbolInformationNode`.
107
+ * @param roots the list of `OutlineSymbolInformationNode`.
108
+ */
109
+ public setOutlineTree(roots: OutlineSymbolInformationNode[]): void {
110
+ // Gather the list of available nodes.
111
+ const nodes = this.reconcileTreeState(roots);
112
+ // Update the model root node, appending the outline symbol information nodes as children.
113
+ this.model.root = this.getRoot(nodes);
114
+ }
115
+
116
+ protected getRoot(children: TreeNode[]): CompositeTreeNode {
117
+ return {
118
+ id: 'outline-view-root',
119
+ name: OutlineViewWidget.LABEL,
120
+ visible: false,
121
+ children,
122
+ parent: undefined
123
+ };
124
+ }
125
+
126
+ /**
127
+ * Reconcile the outline tree state, gathering all available nodes.
128
+ * @param nodes the list of `TreeNode`.
129
+ *
130
+ * @returns the list of tree nodes.
131
+ */
132
+ protected reconcileTreeState(nodes: TreeNode[]): TreeNode[] {
133
+ nodes.forEach(node => {
134
+ if (OutlineSymbolInformationNode.is(node)) {
135
+ const treeNode = this.model.getNode(node.id);
136
+ if (treeNode && OutlineSymbolInformationNode.is(treeNode)) {
137
+ treeNode.expanded = node.expanded;
138
+ treeNode.selected = node.selected;
139
+ }
140
+ this.reconcileTreeState(Array.from(node.children));
141
+ }
142
+ });
143
+ return nodes;
144
+ }
145
+
146
+ protected override onAfterHide(msg: Message): void {
147
+ super.onAfterHide(msg);
148
+ this.onDidChangeOpenStateEmitter.fire(false);
149
+ }
150
+
151
+ protected override onAfterShow(msg: Message): void {
152
+ super.onAfterShow(msg);
153
+ this.onDidChangeOpenStateEmitter.fire(true);
154
+ }
155
+
156
+ override renderIcon(node: TreeNode, props: NodeProps): React.ReactNode {
157
+ if (OutlineSymbolInformationNode.is(node)) {
158
+ return <div className={'symbol-icon-center codicon codicon-symbol-' + node.iconClass}></div>;
159
+ }
160
+ return undefined;
161
+ }
162
+
163
+ protected override createNodeAttributes(node: TreeNode, props: NodeProps): React.Attributes & React.HTMLAttributes<HTMLElement> {
164
+ const elementAttrs = super.createNodeAttributes(node, props);
165
+ return {
166
+ ...elementAttrs,
167
+ title: this.getNodeTooltip(node)
168
+ };
169
+ }
170
+
171
+ /**
172
+ * Get the tooltip for the given tree node.
173
+ * - The tooltip is discovered when hovering over a tree node.
174
+ * - If available, the tooltip is the concatenation of the node name, and it's type.
175
+ * @param node the tree node.
176
+ *
177
+ * @returns the tooltip for the tree node if available, else `undefined`.
178
+ */
179
+ protected getNodeTooltip(node: TreeNode): string | undefined {
180
+ if (OutlineSymbolInformationNode.is(node)) {
181
+ return node.name + ` (${node.iconClass})`;
182
+ }
183
+ return undefined;
184
+ }
185
+
186
+ protected override isExpandable(node: TreeNode): node is ExpandableTreeNode {
187
+ return OutlineSymbolInformationNode.is(node) && node.children.length > 0;
188
+ }
189
+
190
+ protected override renderTree(model: TreeModel): React.ReactNode {
191
+ if (CompositeTreeNode.is(this.model.root) && !this.model.root.children.length) {
192
+ return <div className='theia-widget-noInfo no-outline'>{nls.localizeByDefault('The active editor cannot provide outline information.')}</div>;
193
+ }
194
+ return super.renderTree(model);
195
+ }
196
+
197
+ protected override deflateForStorage(node: TreeNode): object {
198
+ const deflated = super.deflateForStorage(node) as { uri: string };
199
+ if (UriSelection.is(node)) {
200
+ deflated.uri = node.uri.toString();
201
+ }
202
+ return deflated;
203
+ }
204
+
205
+ protected override inflateFromStorage(node: any, parent?: TreeNode): TreeNode { /* eslint-disable-line @typescript-eslint/no-explicit-any */
206
+ const inflated = super.inflateFromStorage(node, parent) as Mutable<TreeNode & UriSelection>;
207
+ if (node && 'uri' in node && typeof node.uri === 'string') {
208
+ inflated.uri = new URI(node.uri);
209
+ }
210
+ return inflated;
211
+ }
212
+ }
@@ -1,24 +1,24 @@
1
- /********************************************************************************
2
- * Copyright (C) 2017-2018 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-only WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
-
17
- .no-outline {
18
- color: var(--theia-foreground);
19
- text-align: left;
20
- }
21
-
22
- .theia-side-panel .no-outline {
23
- margin-left: 9px;
24
- }
1
+ /********************************************************************************
2
+ * Copyright (C) 2017-2018 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-only WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ .no-outline {
18
+ color: var(--theia-foreground);
19
+ text-align: left;
20
+ }
21
+
22
+ .theia-side-panel .no-outline {
23
+ margin-left: 9px;
24
+ }