@theia/outline-view 1.53.0-next.4 → 1.53.0-next.55

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 CHANGED
@@ -1,30 +1,30 @@
1
- <div align='center'>
2
-
3
- <br />
4
-
5
- <img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
6
-
7
- <h2>ECLIPSE THEIA - OUTLINE-VIEW EXTENSION</h2>
8
-
9
- <hr />
10
-
11
- </div>
12
-
13
- ## Description
14
-
15
- The `@theia/outline-view` extension contributes the code outline tree based on a document's symbols.
16
-
17
- ## Additional Information
18
-
19
- - [API documentation for `@theia/outline-view`](https://eclipse-theia.github.io/theia/docs/next/modules/outline_view.html)
20
- - [Theia - GitHub](https://github.com/eclipse-theia/theia)
21
- - [Theia - Website](https://theia-ide.org/)
22
-
23
- ## License
24
-
25
- - [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
26
- - [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
27
-
28
- ## Trademark
29
- "Theia" is a trademark of the Eclipse Foundation
30
- https://www.eclipse.org/theia
1
+ <div align='center'>
2
+
3
+ <br />
4
+
5
+ <img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
6
+
7
+ <h2>ECLIPSE THEIA - OUTLINE-VIEW EXTENSION</h2>
8
+
9
+ <hr />
10
+
11
+ </div>
12
+
13
+ ## Description
14
+
15
+ The `@theia/outline-view` extension contributes the code outline tree based on a document's symbols.
16
+
17
+ ## Additional Information
18
+
19
+ - [API documentation for `@theia/outline-view`](https://eclipse-theia.github.io/theia/docs/next/modules/outline_view.html)
20
+ - [Theia - GitHub](https://github.com/eclipse-theia/theia)
21
+ - [Theia - Website](https://theia-ide.org/)
22
+
23
+ ## License
24
+
25
+ - [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
26
+ - [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
27
+
28
+ ## Trademark
29
+ "Theia" is a trademark of the Eclipse Foundation
30
+ https://www.eclipse.org/theia
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@theia/outline-view",
3
- "version": "1.53.0-next.4+9e9124118",
3
+ "version": "1.53.0-next.55+d1a989a68c",
4
4
  "description": "Theia - Outline View Extension",
5
5
  "dependencies": {
6
- "@theia/core": "1.53.0-next.4+9e9124118",
6
+ "@theia/core": "1.53.0-next.55+d1a989a68c",
7
7
  "tslib": "^2.6.2"
8
8
  },
9
9
  "publishConfig": {
@@ -39,10 +39,10 @@
39
39
  "watch": "theiaext watch"
40
40
  },
41
41
  "devDependencies": {
42
- "@theia/ext-scripts": "1.52.0"
42
+ "@theia/ext-scripts": "1.53.0"
43
43
  },
44
44
  "nyc": {
45
45
  "extends": "../../configs/nyc.json"
46
46
  },
47
- "gitHead": "9e912411843f32b2a549ef6580b07872edd95e8b"
47
+ "gitHead": "d1a989a68c1b5ec1f9098e9126653c6346844769"
48
48
  }
@@ -1,18 +1,18 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2017 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
- export * from './outline-view-widget';
18
- export * from './outline-view-frontend-module';
1
+ // *****************************************************************************
2
+ // Copyright (C) 2017 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
+ export * from './outline-view-widget';
18
+ export * from './outline-view-frontend-module';
@@ -1,233 +1,233 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2019 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 { LabelProvider, BreadcrumbsService, Widget, TreeNode, OpenerService, open, SelectableTreeNode, BreadcrumbsContribution, Breadcrumb } from '@theia/core/lib/browser';
19
- import URI from '@theia/core/lib/common/uri';
20
- import { OutlineViewService } from './outline-view-service';
21
- import { OutlineSymbolInformationNode, OutlineViewWidget } from './outline-view-widget';
22
- import { Disposable, DisposableCollection, Emitter, Event, UriSelection } from '@theia/core/lib/common';
23
-
24
- export const OutlineBreadcrumbType = Symbol('OutlineBreadcrumb');
25
- export const BreadcrumbPopupOutlineViewFactory = Symbol('BreadcrumbPopupOutlineViewFactory');
26
- export const OUTLINE_BREADCRUMB_CONTAINER_CLASS = 'outline-element';
27
- export interface BreadcrumbPopupOutlineViewFactory {
28
- (): BreadcrumbPopupOutlineView;
29
- }
30
- export class BreadcrumbPopupOutlineView extends OutlineViewWidget {
31
- @inject(OpenerService) protected readonly openerService: OpenerService;
32
-
33
- @inject(OutlineViewService)
34
- protected readonly outlineViewService: OutlineViewService;
35
-
36
- protected override tapNode(node?: TreeNode): void {
37
- if (UriSelection.is(node) && OutlineSymbolInformationNode.hasRange(node)) {
38
- open(this.openerService, node.uri, { selection: node.range });
39
- } else {
40
- this.outlineViewService.didTapNode(node as OutlineSymbolInformationNode);
41
- super.tapNode(node);
42
- }
43
- }
44
-
45
- cloneState(roots: OutlineSymbolInformationNode[]): void {
46
- const nodes = this.reconcileTreeState(roots);
47
- const root = this.getRoot(nodes);
48
- this.model.root = this.inflateFromStorage(this.deflateForStorage(root));
49
- }
50
- }
51
-
52
- @injectable()
53
- export class OutlineBreadcrumbsContribution implements BreadcrumbsContribution {
54
- @inject(LabelProvider)
55
- protected readonly labelProvider: LabelProvider;
56
-
57
- @inject(OutlineViewService)
58
- protected readonly outlineViewService: OutlineViewService;
59
-
60
- @inject(BreadcrumbsService)
61
- protected readonly breadcrumbsService: BreadcrumbsService;
62
-
63
- @inject(BreadcrumbPopupOutlineViewFactory)
64
- protected readonly outlineFactory: BreadcrumbPopupOutlineViewFactory;
65
-
66
- protected outlineView: BreadcrumbPopupOutlineView;
67
-
68
- readonly type = OutlineBreadcrumbType;
69
- readonly priority: number = 200;
70
-
71
- protected currentUri: URI | undefined = undefined;
72
- protected currentBreadcrumbs: OutlineBreadcrumb[] = [];
73
- protected roots: OutlineSymbolInformationNode[] = [];
74
-
75
- protected readonly onDidChangeBreadcrumbsEmitter = new Emitter<URI>();
76
- get onDidChangeBreadcrumbs(): Event<URI> {
77
- return this.onDidChangeBreadcrumbsEmitter.event;
78
- }
79
-
80
- @postConstruct()
81
- init(): void {
82
- this.outlineView = this.outlineFactory();
83
- this.outlineView.node.style.height = 'auto';
84
- this.outlineView.node.style.maxHeight = '200px';
85
- this.outlineViewService.onDidChangeOutline(roots => {
86
- if (roots.length > 0) {
87
- this.roots = roots;
88
- const first = roots[0];
89
- if (UriSelection.is(first)) {
90
- this.updateOutlineItems(first.uri, this.findSelectedNode(roots));
91
- }
92
- } else {
93
- this.currentBreadcrumbs = [];
94
- this.roots = [];
95
- }
96
- });
97
- this.outlineViewService.onDidSelect(node => {
98
- if (UriSelection.is(node)) {
99
- this.updateOutlineItems(node.uri, node);
100
- }
101
- });
102
- }
103
-
104
- protected async updateOutlineItems(uri: URI, selectedNode: OutlineSymbolInformationNode | undefined): Promise<void> {
105
- this.currentUri = uri;
106
- const outlinePath = this.toOutlinePath(selectedNode);
107
- if (outlinePath && selectedNode) {
108
- this.currentBreadcrumbs = outlinePath.map((node, index) =>
109
- new OutlineBreadcrumb(
110
- node,
111
- uri,
112
- index.toString(),
113
- this.labelProvider.getName(node),
114
- 'symbol-icon-center codicon codicon-symbol-' + node.iconClass,
115
- OUTLINE_BREADCRUMB_CONTAINER_CLASS,
116
- )
117
- );
118
- if (selectedNode.children && selectedNode.children.length > 0) {
119
- this.currentBreadcrumbs.push(new OutlineBreadcrumb(
120
- selectedNode.children as OutlineSymbolInformationNode[],
121
- uri,
122
- this.currentBreadcrumbs.length.toString(),
123
- '…',
124
- '',
125
- OUTLINE_BREADCRUMB_CONTAINER_CLASS,
126
- ));
127
- }
128
- } else {
129
- this.currentBreadcrumbs = [];
130
- if (this.roots) {
131
- this.currentBreadcrumbs.push(new OutlineBreadcrumb(
132
- this.roots,
133
- uri,
134
- this.currentBreadcrumbs.length.toString(),
135
- '…',
136
- '',
137
- OUTLINE_BREADCRUMB_CONTAINER_CLASS
138
- ));
139
- }
140
- }
141
- this.onDidChangeBreadcrumbsEmitter.fire(uri);
142
- }
143
-
144
- async computeBreadcrumbs(uri: URI): Promise<Breadcrumb[]> {
145
- if (this.currentUri && uri.toString() === this.currentUri.toString()) {
146
- return this.currentBreadcrumbs;
147
- }
148
- return [];
149
- }
150
-
151
- async attachPopupContent(breadcrumb: Breadcrumb, parent: HTMLElement): Promise<Disposable | undefined> {
152
- if (!OutlineBreadcrumb.is(breadcrumb)) {
153
- return undefined;
154
- }
155
- const node = Array.isArray(breadcrumb.node) ? breadcrumb.node[0] : breadcrumb.node;
156
- if (!node.parent) {
157
- return undefined;
158
- }
159
- const siblings = node.parent.children.filter((child): child is OutlineSymbolInformationNode => OutlineSymbolInformationNode.is(child));
160
-
161
- const toDisposeOnHide = new DisposableCollection();
162
- this.outlineView.cloneState(siblings);
163
- this.outlineView.model.selectNode(node);
164
- this.outlineView.model.collapseAll();
165
- Widget.attach(this.outlineView, parent);
166
- this.outlineView.activate();
167
- toDisposeOnHide.pushAll([
168
- this.outlineView.model.onExpansionChanged(expandedNode => SelectableTreeNode.is(expandedNode) && this.outlineView.model.selectNode(expandedNode)),
169
- Disposable.create(() => {
170
- this.outlineView.model.root = undefined;
171
- Widget.detach(this.outlineView);
172
- }),
173
- ]);
174
- return toDisposeOnHide;
175
- }
176
-
177
- /**
178
- * Returns the path of the given outline node.
179
- */
180
- protected toOutlinePath(node: OutlineSymbolInformationNode | undefined, path: OutlineSymbolInformationNode[] = []): OutlineSymbolInformationNode[] | undefined {
181
- if (!node) { return undefined; }
182
- if (node.id === 'outline-view-root') { return path; }
183
- if (node.parent) {
184
- return this.toOutlinePath(node.parent as OutlineSymbolInformationNode, [node, ...path]);
185
- } else {
186
- return [node, ...path];
187
- }
188
- }
189
-
190
- /**
191
- * Find the node that is selected. Returns after the first match.
192
- */
193
- protected findSelectedNode(roots: OutlineSymbolInformationNode[]): OutlineSymbolInformationNode | undefined {
194
- const result = roots.find(node => node.selected);
195
- if (result) {
196
- return result;
197
- }
198
- for (const node of roots) {
199
- const result2 = this.findSelectedNode(node.children.map(child => child as OutlineSymbolInformationNode));
200
- if (result2) {
201
- return result2;
202
- }
203
- }
204
- }
205
- }
206
-
207
- export class OutlineBreadcrumb implements Breadcrumb {
208
- constructor(
209
- readonly node: OutlineSymbolInformationNode | OutlineSymbolInformationNode[],
210
- readonly uri: URI,
211
- readonly index: string,
212
- readonly label: string,
213
- readonly iconClass: string,
214
- readonly containerClass: string,
215
- ) { }
216
-
217
- get id(): string {
218
- return this.type.toString() + '_' + this.uri.toString() + '_' + this.index;
219
- }
220
-
221
- get type(): symbol {
222
- return OutlineBreadcrumbType;
223
- }
224
-
225
- get longLabel(): string {
226
- return this.label;
227
- }
228
- }
229
- export namespace OutlineBreadcrumb {
230
- export function is(breadcrumb: Breadcrumb): breadcrumb is OutlineBreadcrumb {
231
- return 'node' in breadcrumb && 'uri' in breadcrumb;
232
- }
233
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 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 { LabelProvider, BreadcrumbsService, Widget, TreeNode, OpenerService, open, SelectableTreeNode, BreadcrumbsContribution, Breadcrumb } from '@theia/core/lib/browser';
19
+ import URI from '@theia/core/lib/common/uri';
20
+ import { OutlineViewService } from './outline-view-service';
21
+ import { OutlineSymbolInformationNode, OutlineViewWidget } from './outline-view-widget';
22
+ import { Disposable, DisposableCollection, Emitter, Event, UriSelection } from '@theia/core/lib/common';
23
+
24
+ export const OutlineBreadcrumbType = Symbol('OutlineBreadcrumb');
25
+ export const BreadcrumbPopupOutlineViewFactory = Symbol('BreadcrumbPopupOutlineViewFactory');
26
+ export const OUTLINE_BREADCRUMB_CONTAINER_CLASS = 'outline-element';
27
+ export interface BreadcrumbPopupOutlineViewFactory {
28
+ (): BreadcrumbPopupOutlineView;
29
+ }
30
+ export class BreadcrumbPopupOutlineView extends OutlineViewWidget {
31
+ @inject(OpenerService) protected readonly openerService: OpenerService;
32
+
33
+ @inject(OutlineViewService)
34
+ protected readonly outlineViewService: OutlineViewService;
35
+
36
+ protected override tapNode(node?: TreeNode): void {
37
+ if (UriSelection.is(node) && OutlineSymbolInformationNode.hasRange(node)) {
38
+ open(this.openerService, node.uri, { selection: node.range });
39
+ } else {
40
+ this.outlineViewService.didTapNode(node as OutlineSymbolInformationNode);
41
+ super.tapNode(node);
42
+ }
43
+ }
44
+
45
+ cloneState(roots: OutlineSymbolInformationNode[]): void {
46
+ const nodes = this.reconcileTreeState(roots);
47
+ const root = this.getRoot(nodes);
48
+ this.model.root = this.inflateFromStorage(this.deflateForStorage(root));
49
+ }
50
+ }
51
+
52
+ @injectable()
53
+ export class OutlineBreadcrumbsContribution implements BreadcrumbsContribution {
54
+ @inject(LabelProvider)
55
+ protected readonly labelProvider: LabelProvider;
56
+
57
+ @inject(OutlineViewService)
58
+ protected readonly outlineViewService: OutlineViewService;
59
+
60
+ @inject(BreadcrumbsService)
61
+ protected readonly breadcrumbsService: BreadcrumbsService;
62
+
63
+ @inject(BreadcrumbPopupOutlineViewFactory)
64
+ protected readonly outlineFactory: BreadcrumbPopupOutlineViewFactory;
65
+
66
+ protected outlineView: BreadcrumbPopupOutlineView;
67
+
68
+ readonly type = OutlineBreadcrumbType;
69
+ readonly priority: number = 200;
70
+
71
+ protected currentUri: URI | undefined = undefined;
72
+ protected currentBreadcrumbs: OutlineBreadcrumb[] = [];
73
+ protected roots: OutlineSymbolInformationNode[] = [];
74
+
75
+ protected readonly onDidChangeBreadcrumbsEmitter = new Emitter<URI>();
76
+ get onDidChangeBreadcrumbs(): Event<URI> {
77
+ return this.onDidChangeBreadcrumbsEmitter.event;
78
+ }
79
+
80
+ @postConstruct()
81
+ init(): void {
82
+ this.outlineView = this.outlineFactory();
83
+ this.outlineView.node.style.height = 'auto';
84
+ this.outlineView.node.style.maxHeight = '200px';
85
+ this.outlineViewService.onDidChangeOutline(roots => {
86
+ if (roots.length > 0) {
87
+ this.roots = roots;
88
+ const first = roots[0];
89
+ if (UriSelection.is(first)) {
90
+ this.updateOutlineItems(first.uri, this.findSelectedNode(roots));
91
+ }
92
+ } else {
93
+ this.currentBreadcrumbs = [];
94
+ this.roots = [];
95
+ }
96
+ });
97
+ this.outlineViewService.onDidSelect(node => {
98
+ if (UriSelection.is(node)) {
99
+ this.updateOutlineItems(node.uri, node);
100
+ }
101
+ });
102
+ }
103
+
104
+ protected async updateOutlineItems(uri: URI, selectedNode: OutlineSymbolInformationNode | undefined): Promise<void> {
105
+ this.currentUri = uri;
106
+ const outlinePath = this.toOutlinePath(selectedNode);
107
+ if (outlinePath && selectedNode) {
108
+ this.currentBreadcrumbs = outlinePath.map((node, index) =>
109
+ new OutlineBreadcrumb(
110
+ node,
111
+ uri,
112
+ index.toString(),
113
+ this.labelProvider.getName(node),
114
+ 'symbol-icon-center codicon codicon-symbol-' + node.iconClass,
115
+ OUTLINE_BREADCRUMB_CONTAINER_CLASS,
116
+ )
117
+ );
118
+ if (selectedNode.children && selectedNode.children.length > 0) {
119
+ this.currentBreadcrumbs.push(new OutlineBreadcrumb(
120
+ selectedNode.children as OutlineSymbolInformationNode[],
121
+ uri,
122
+ this.currentBreadcrumbs.length.toString(),
123
+ '…',
124
+ '',
125
+ OUTLINE_BREADCRUMB_CONTAINER_CLASS,
126
+ ));
127
+ }
128
+ } else {
129
+ this.currentBreadcrumbs = [];
130
+ if (this.roots) {
131
+ this.currentBreadcrumbs.push(new OutlineBreadcrumb(
132
+ this.roots,
133
+ uri,
134
+ this.currentBreadcrumbs.length.toString(),
135
+ '…',
136
+ '',
137
+ OUTLINE_BREADCRUMB_CONTAINER_CLASS
138
+ ));
139
+ }
140
+ }
141
+ this.onDidChangeBreadcrumbsEmitter.fire(uri);
142
+ }
143
+
144
+ async computeBreadcrumbs(uri: URI): Promise<Breadcrumb[]> {
145
+ if (this.currentUri && uri.toString() === this.currentUri.toString()) {
146
+ return this.currentBreadcrumbs;
147
+ }
148
+ return [];
149
+ }
150
+
151
+ async attachPopupContent(breadcrumb: Breadcrumb, parent: HTMLElement): Promise<Disposable | undefined> {
152
+ if (!OutlineBreadcrumb.is(breadcrumb)) {
153
+ return undefined;
154
+ }
155
+ const node = Array.isArray(breadcrumb.node) ? breadcrumb.node[0] : breadcrumb.node;
156
+ if (!node.parent) {
157
+ return undefined;
158
+ }
159
+ const siblings = node.parent.children.filter((child): child is OutlineSymbolInformationNode => OutlineSymbolInformationNode.is(child));
160
+
161
+ const toDisposeOnHide = new DisposableCollection();
162
+ this.outlineView.cloneState(siblings);
163
+ this.outlineView.model.selectNode(node);
164
+ this.outlineView.model.collapseAll();
165
+ Widget.attach(this.outlineView, parent);
166
+ this.outlineView.activate();
167
+ toDisposeOnHide.pushAll([
168
+ this.outlineView.model.onExpansionChanged(expandedNode => SelectableTreeNode.is(expandedNode) && this.outlineView.model.selectNode(expandedNode)),
169
+ Disposable.create(() => {
170
+ this.outlineView.model.root = undefined;
171
+ Widget.detach(this.outlineView);
172
+ }),
173
+ ]);
174
+ return toDisposeOnHide;
175
+ }
176
+
177
+ /**
178
+ * Returns the path of the given outline node.
179
+ */
180
+ protected toOutlinePath(node: OutlineSymbolInformationNode | undefined, path: OutlineSymbolInformationNode[] = []): OutlineSymbolInformationNode[] | undefined {
181
+ if (!node) { return undefined; }
182
+ if (node.id === 'outline-view-root') { return path; }
183
+ if (node.parent) {
184
+ return this.toOutlinePath(node.parent as OutlineSymbolInformationNode, [node, ...path]);
185
+ } else {
186
+ return [node, ...path];
187
+ }
188
+ }
189
+
190
+ /**
191
+ * Find the node that is selected. Returns after the first match.
192
+ */
193
+ protected findSelectedNode(roots: OutlineSymbolInformationNode[]): OutlineSymbolInformationNode | undefined {
194
+ const result = roots.find(node => node.selected);
195
+ if (result) {
196
+ return result;
197
+ }
198
+ for (const node of roots) {
199
+ const result2 = this.findSelectedNode(node.children.map(child => child as OutlineSymbolInformationNode));
200
+ if (result2) {
201
+ return result2;
202
+ }
203
+ }
204
+ }
205
+ }
206
+
207
+ export class OutlineBreadcrumb implements Breadcrumb {
208
+ constructor(
209
+ readonly node: OutlineSymbolInformationNode | OutlineSymbolInformationNode[],
210
+ readonly uri: URI,
211
+ readonly index: string,
212
+ readonly label: string,
213
+ readonly iconClass: string,
214
+ readonly containerClass: string,
215
+ ) { }
216
+
217
+ get id(): string {
218
+ return this.type.toString() + '_' + this.uri.toString() + '_' + this.index;
219
+ }
220
+
221
+ get type(): symbol {
222
+ return OutlineBreadcrumbType;
223
+ }
224
+
225
+ get longLabel(): string {
226
+ return this.label;
227
+ }
228
+ }
229
+ export namespace OutlineBreadcrumb {
230
+ export function is(breadcrumb: Breadcrumb): breadcrumb is OutlineBreadcrumb {
231
+ return 'node' in breadcrumb && 'uri' in breadcrumb;
232
+ }
233
+ }