@theia/outline-view 1.34.2 → 1.34.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.
- package/LICENSE +641 -641
- package/README.md +30 -30
- package/lib/browser/index.d.ts +2 -2
- package/lib/browser/index.js +29 -29
- package/lib/browser/outline-breadcrumbs-contribution.d.ts +57 -57
- package/lib/browser/outline-breadcrumbs-contribution.js +222 -222
- package/lib/browser/outline-decorator-service.d.ts +13 -13
- package/lib/browser/outline-decorator-service.js +53 -53
- package/lib/browser/outline-view-contribution.d.ts +31 -31
- package/lib/browser/outline-view-contribution.js +108 -108
- package/lib/browser/outline-view-frontend-module.d.ts +4 -4
- package/lib/browser/outline-view-frontend-module.js +68 -68
- package/lib/browser/outline-view-service.d.ts +26 -26
- package/lib/browser/outline-view-service.js +89 -89
- package/lib/browser/outline-view-tree-model.d.ts +17 -17
- package/lib/browser/outline-view-tree-model.js +59 -59
- package/lib/browser/outline-view-widget.d.ts +73 -73
- package/lib/browser/outline-view-widget.js +180 -180
- package/lib/package.spec.js +25 -25
- package/package.json +4 -4
- package/src/browser/index.ts +18 -18
- package/src/browser/outline-breadcrumbs-contribution.tsx +229 -229
- package/src/browser/outline-decorator-service.ts +36 -36
- package/src/browser/outline-view-contribution.ts +104 -104
- package/src/browser/outline-view-frontend-module.ts +84 -84
- package/src/browser/outline-view-service.ts +82 -82
- package/src/browser/outline-view-tree-model.ts +52 -52
- package/src/browser/outline-view-widget.tsx +203 -203
- package/src/browser/styles/index.css +24 -24
- package/src/package.spec.ts +28 -28
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2019 Ericsson and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.OutlineViewTreeModel = void 0;
|
|
25
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
26
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
27
|
-
let OutlineViewTreeModel = class OutlineViewTreeModel extends browser_1.TreeModelImpl {
|
|
28
|
-
/**
|
|
29
|
-
* Handle the expansion of the tree node.
|
|
30
|
-
* - The method is a no-op in order to preserve focus on the editor
|
|
31
|
-
* after attempting to perform a `collapse-all`.
|
|
32
|
-
* @param node the expandable tree node.
|
|
33
|
-
*/
|
|
34
|
-
handleExpansion(node) {
|
|
35
|
-
// no-op
|
|
36
|
-
}
|
|
37
|
-
async collapseAll(raw) {
|
|
38
|
-
const node = raw || this.getFocusedNode();
|
|
39
|
-
if (browser_1.CompositeTreeNode.is(node)) {
|
|
40
|
-
return this.expansionService.collapseAll(node);
|
|
41
|
-
}
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* The default behavior of `openNode` calls `doOpenNode` which by default
|
|
46
|
-
* toggles the expansion of the node. Overriding to prevent expansion, but
|
|
47
|
-
* allow for the `onOpenNode` event to still fire on a double-click event.
|
|
48
|
-
*/
|
|
49
|
-
openNode(raw) {
|
|
50
|
-
const node = raw || this.getFocusedNode();
|
|
51
|
-
if (node) {
|
|
52
|
-
this.onOpenNodeEmitter.fire(node);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
OutlineViewTreeModel = __decorate([
|
|
57
|
-
(0, inversify_1.injectable)()
|
|
58
|
-
], OutlineViewTreeModel);
|
|
59
|
-
exports.OutlineViewTreeModel = OutlineViewTreeModel;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2019 Ericsson and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.OutlineViewTreeModel = void 0;
|
|
25
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
26
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
27
|
+
let OutlineViewTreeModel = class OutlineViewTreeModel extends browser_1.TreeModelImpl {
|
|
28
|
+
/**
|
|
29
|
+
* Handle the expansion of the tree node.
|
|
30
|
+
* - The method is a no-op in order to preserve focus on the editor
|
|
31
|
+
* after attempting to perform a `collapse-all`.
|
|
32
|
+
* @param node the expandable tree node.
|
|
33
|
+
*/
|
|
34
|
+
handleExpansion(node) {
|
|
35
|
+
// no-op
|
|
36
|
+
}
|
|
37
|
+
async collapseAll(raw) {
|
|
38
|
+
const node = raw || this.getFocusedNode();
|
|
39
|
+
if (browser_1.CompositeTreeNode.is(node)) {
|
|
40
|
+
return this.expansionService.collapseAll(node);
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The default behavior of `openNode` calls `doOpenNode` which by default
|
|
46
|
+
* toggles the expansion of the node. Overriding to prevent expansion, but
|
|
47
|
+
* allow for the `onOpenNode` event to still fire on a double-click event.
|
|
48
|
+
*/
|
|
49
|
+
openNode(raw) {
|
|
50
|
+
const node = raw || this.getFocusedNode();
|
|
51
|
+
if (node) {
|
|
52
|
+
this.onOpenNodeEmitter.fire(node);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
OutlineViewTreeModel = __decorate([
|
|
57
|
+
(0, inversify_1.injectable)()
|
|
58
|
+
], OutlineViewTreeModel);
|
|
59
|
+
exports.OutlineViewTreeModel = OutlineViewTreeModel;
|
|
60
60
|
//# sourceMappingURL=outline-view-tree-model.js.map
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { TreeWidget, TreeNode, NodeProps, SelectableTreeNode, CompositeTreeNode, TreeProps, ContextMenuRenderer, TreeModel, ExpandableTreeNode } from '@theia/core/lib/browser';
|
|
3
|
-
import { OutlineViewTreeModel } from './outline-view-tree-model';
|
|
4
|
-
import { Message } from '@theia/core/shared/@phosphor/messaging';
|
|
5
|
-
import { Emitter } from '@theia/core';
|
|
6
|
-
import * as React from '@theia/core/shared/react';
|
|
7
|
-
import { Range } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
8
|
-
/**
|
|
9
|
-
* Representation of an outline symbol information node.
|
|
10
|
-
*/
|
|
11
|
-
export interface OutlineSymbolInformationNode extends CompositeTreeNode, SelectableTreeNode, ExpandableTreeNode {
|
|
12
|
-
/**
|
|
13
|
-
* The `iconClass` for the given tree node.
|
|
14
|
-
*/
|
|
15
|
-
iconClass: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Collection of outline symbol information node functions.
|
|
19
|
-
*/
|
|
20
|
-
export declare namespace OutlineSymbolInformationNode {
|
|
21
|
-
/**
|
|
22
|
-
* Determine if the given tree node is an `OutlineSymbolInformationNode`.
|
|
23
|
-
* - The tree node is an `OutlineSymbolInformationNode` if:
|
|
24
|
-
* - The node exists.
|
|
25
|
-
* - The node is selectable.
|
|
26
|
-
* - The node contains a defined `iconClass` property.
|
|
27
|
-
* @param node the tree node.
|
|
28
|
-
*
|
|
29
|
-
* @returns `true` if the given node is an `OutlineSymbolInformationNode`.
|
|
30
|
-
*/
|
|
31
|
-
function is(node: TreeNode): node is OutlineSymbolInformationNode;
|
|
32
|
-
function hasRange(node: unknown): node is {
|
|
33
|
-
range: Range;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export declare type OutlineViewWidgetFactory = () => OutlineViewWidget;
|
|
37
|
-
export declare const OutlineViewWidgetFactory: unique symbol;
|
|
38
|
-
export declare class OutlineViewWidget extends TreeWidget {
|
|
39
|
-
readonly model: OutlineViewTreeModel;
|
|
40
|
-
static LABEL: string;
|
|
41
|
-
readonly onDidChangeOpenStateEmitter: Emitter<boolean>;
|
|
42
|
-
constructor(treeProps: TreeProps, model: OutlineViewTreeModel, contextMenuRenderer: ContextMenuRenderer);
|
|
43
|
-
/**
|
|
44
|
-
* Set the outline tree with the list of `OutlineSymbolInformationNode`.
|
|
45
|
-
* @param roots the list of `OutlineSymbolInformationNode`.
|
|
46
|
-
*/
|
|
47
|
-
setOutlineTree(roots: OutlineSymbolInformationNode[]): void;
|
|
48
|
-
protected getRoot(children: TreeNode[]): CompositeTreeNode;
|
|
49
|
-
/**
|
|
50
|
-
* Reconcile the outline tree state, gathering all available nodes.
|
|
51
|
-
* @param nodes the list of `TreeNode`.
|
|
52
|
-
*
|
|
53
|
-
* @returns the list of tree nodes.
|
|
54
|
-
*/
|
|
55
|
-
protected reconcileTreeState(nodes: TreeNode[]): TreeNode[];
|
|
56
|
-
protected onAfterHide(msg: Message): void;
|
|
57
|
-
protected onAfterShow(msg: Message): void;
|
|
58
|
-
renderIcon(node: TreeNode, props: NodeProps): React.ReactNode;
|
|
59
|
-
protected createNodeAttributes(node: TreeNode, props: NodeProps): React.Attributes & React.HTMLAttributes<HTMLElement>;
|
|
60
|
-
/**
|
|
61
|
-
* Get the tooltip for the given tree node.
|
|
62
|
-
* - The tooltip is discovered when hovering over a tree node.
|
|
63
|
-
* - If available, the tooltip is the concatenation of the node name, and it's type.
|
|
64
|
-
* @param node the tree node.
|
|
65
|
-
*
|
|
66
|
-
* @returns the tooltip for the tree node if available, else `undefined`.
|
|
67
|
-
*/
|
|
68
|
-
protected getNodeTooltip(node: TreeNode): string | undefined;
|
|
69
|
-
protected isExpandable(node: TreeNode): node is ExpandableTreeNode;
|
|
70
|
-
protected renderTree(model: TreeModel): React.ReactNode;
|
|
71
|
-
protected deflateForStorage(node: TreeNode): object;
|
|
72
|
-
protected inflateFromStorage(node: any, parent?: TreeNode): TreeNode;
|
|
73
|
-
}
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TreeWidget, TreeNode, NodeProps, SelectableTreeNode, CompositeTreeNode, TreeProps, ContextMenuRenderer, TreeModel, ExpandableTreeNode } from '@theia/core/lib/browser';
|
|
3
|
+
import { OutlineViewTreeModel } from './outline-view-tree-model';
|
|
4
|
+
import { Message } from '@theia/core/shared/@phosphor/messaging';
|
|
5
|
+
import { Emitter } from '@theia/core';
|
|
6
|
+
import * as React from '@theia/core/shared/react';
|
|
7
|
+
import { Range } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
8
|
+
/**
|
|
9
|
+
* Representation of an outline symbol information node.
|
|
10
|
+
*/
|
|
11
|
+
export interface OutlineSymbolInformationNode extends CompositeTreeNode, SelectableTreeNode, ExpandableTreeNode {
|
|
12
|
+
/**
|
|
13
|
+
* The `iconClass` for the given tree node.
|
|
14
|
+
*/
|
|
15
|
+
iconClass: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Collection of outline symbol information node functions.
|
|
19
|
+
*/
|
|
20
|
+
export declare namespace OutlineSymbolInformationNode {
|
|
21
|
+
/**
|
|
22
|
+
* Determine if the given tree node is an `OutlineSymbolInformationNode`.
|
|
23
|
+
* - The tree node is an `OutlineSymbolInformationNode` if:
|
|
24
|
+
* - The node exists.
|
|
25
|
+
* - The node is selectable.
|
|
26
|
+
* - The node contains a defined `iconClass` property.
|
|
27
|
+
* @param node the tree node.
|
|
28
|
+
*
|
|
29
|
+
* @returns `true` if the given node is an `OutlineSymbolInformationNode`.
|
|
30
|
+
*/
|
|
31
|
+
function is(node: TreeNode): node is OutlineSymbolInformationNode;
|
|
32
|
+
function hasRange(node: unknown): node is {
|
|
33
|
+
range: Range;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export declare type OutlineViewWidgetFactory = () => OutlineViewWidget;
|
|
37
|
+
export declare const OutlineViewWidgetFactory: unique symbol;
|
|
38
|
+
export declare class OutlineViewWidget extends TreeWidget {
|
|
39
|
+
readonly model: OutlineViewTreeModel;
|
|
40
|
+
static LABEL: string;
|
|
41
|
+
readonly onDidChangeOpenStateEmitter: Emitter<boolean>;
|
|
42
|
+
constructor(treeProps: TreeProps, model: OutlineViewTreeModel, contextMenuRenderer: ContextMenuRenderer);
|
|
43
|
+
/**
|
|
44
|
+
* Set the outline tree with the list of `OutlineSymbolInformationNode`.
|
|
45
|
+
* @param roots the list of `OutlineSymbolInformationNode`.
|
|
46
|
+
*/
|
|
47
|
+
setOutlineTree(roots: OutlineSymbolInformationNode[]): void;
|
|
48
|
+
protected getRoot(children: TreeNode[]): CompositeTreeNode;
|
|
49
|
+
/**
|
|
50
|
+
* Reconcile the outline tree state, gathering all available nodes.
|
|
51
|
+
* @param nodes the list of `TreeNode`.
|
|
52
|
+
*
|
|
53
|
+
* @returns the list of tree nodes.
|
|
54
|
+
*/
|
|
55
|
+
protected reconcileTreeState(nodes: TreeNode[]): TreeNode[];
|
|
56
|
+
protected onAfterHide(msg: Message): void;
|
|
57
|
+
protected onAfterShow(msg: Message): void;
|
|
58
|
+
renderIcon(node: TreeNode, props: NodeProps): React.ReactNode;
|
|
59
|
+
protected createNodeAttributes(node: TreeNode, props: NodeProps): React.Attributes & React.HTMLAttributes<HTMLElement>;
|
|
60
|
+
/**
|
|
61
|
+
* Get the tooltip for the given tree node.
|
|
62
|
+
* - The tooltip is discovered when hovering over a tree node.
|
|
63
|
+
* - If available, the tooltip is the concatenation of the node name, and it's type.
|
|
64
|
+
* @param node the tree node.
|
|
65
|
+
*
|
|
66
|
+
* @returns the tooltip for the tree node if available, else `undefined`.
|
|
67
|
+
*/
|
|
68
|
+
protected getNodeTooltip(node: TreeNode): string | undefined;
|
|
69
|
+
protected isExpandable(node: TreeNode): node is ExpandableTreeNode;
|
|
70
|
+
protected renderTree(model: TreeModel): React.ReactNode;
|
|
71
|
+
protected deflateForStorage(node: TreeNode): object;
|
|
72
|
+
protected inflateFromStorage(node: any, parent?: TreeNode): TreeNode;
|
|
73
|
+
}
|
|
74
74
|
//# sourceMappingURL=outline-view-widget.d.ts.map
|
|
@@ -1,181 +1,181 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017-2018 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
-
};
|
|
29
|
-
var OutlineViewWidget_1;
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.OutlineViewWidget = exports.OutlineViewWidgetFactory = exports.OutlineSymbolInformationNode = void 0;
|
|
32
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
33
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
34
|
-
const outline_view_tree_model_1 = require("./outline-view-tree-model");
|
|
35
|
-
const core_1 = require("@theia/core");
|
|
36
|
-
const React = require("@theia/core/shared/react");
|
|
37
|
-
const vscode_languageserver_protocol_1 = require("@theia/core/shared/vscode-languageserver-protocol");
|
|
38
|
-
const uri_1 = require("@theia/core/lib/common/uri");
|
|
39
|
-
const nls_1 = require("@theia/core/lib/common/nls");
|
|
40
|
-
/**
|
|
41
|
-
* Collection of outline symbol information node functions.
|
|
42
|
-
*/
|
|
43
|
-
var OutlineSymbolInformationNode;
|
|
44
|
-
(function (OutlineSymbolInformationNode) {
|
|
45
|
-
/**
|
|
46
|
-
* Determine if the given tree node is an `OutlineSymbolInformationNode`.
|
|
47
|
-
* - The tree node is an `OutlineSymbolInformationNode` if:
|
|
48
|
-
* - The node exists.
|
|
49
|
-
* - The node is selectable.
|
|
50
|
-
* - The node contains a defined `iconClass` property.
|
|
51
|
-
* @param node the tree node.
|
|
52
|
-
*
|
|
53
|
-
* @returns `true` if the given node is an `OutlineSymbolInformationNode`.
|
|
54
|
-
*/
|
|
55
|
-
function is(node) {
|
|
56
|
-
return !!node && browser_1.SelectableTreeNode.is(node) && 'iconClass' in node;
|
|
57
|
-
}
|
|
58
|
-
OutlineSymbolInformationNode.is = is;
|
|
59
|
-
function hasRange(node) {
|
|
60
|
-
return (0, core_1.isObject)(node) && vscode_languageserver_protocol_1.Range.is(node.range);
|
|
61
|
-
}
|
|
62
|
-
OutlineSymbolInformationNode.hasRange = hasRange;
|
|
63
|
-
})(OutlineSymbolInformationNode = exports.OutlineSymbolInformationNode || (exports.OutlineSymbolInformationNode = {}));
|
|
64
|
-
exports.OutlineViewWidgetFactory = Symbol('OutlineViewWidgetFactory');
|
|
65
|
-
let OutlineViewWidget = OutlineViewWidget_1 = class OutlineViewWidget extends browser_1.TreeWidget {
|
|
66
|
-
constructor(treeProps, model, contextMenuRenderer) {
|
|
67
|
-
super(treeProps, model, contextMenuRenderer);
|
|
68
|
-
this.model = model;
|
|
69
|
-
this.onDidChangeOpenStateEmitter = new core_1.Emitter();
|
|
70
|
-
this.id = 'outline-view';
|
|
71
|
-
this.title.label = OutlineViewWidget_1.LABEL;
|
|
72
|
-
this.title.caption = OutlineViewWidget_1.LABEL;
|
|
73
|
-
this.title.closable = true;
|
|
74
|
-
this.title.iconClass = (0, browser_1.codicon)('symbol-class');
|
|
75
|
-
this.addClass('theia-outline-view');
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Set the outline tree with the list of `OutlineSymbolInformationNode`.
|
|
79
|
-
* @param roots the list of `OutlineSymbolInformationNode`.
|
|
80
|
-
*/
|
|
81
|
-
setOutlineTree(roots) {
|
|
82
|
-
// Gather the list of available nodes.
|
|
83
|
-
const nodes = this.reconcileTreeState(roots);
|
|
84
|
-
// Update the model root node, appending the outline symbol information nodes as children.
|
|
85
|
-
this.model.root = this.getRoot(nodes);
|
|
86
|
-
}
|
|
87
|
-
getRoot(children) {
|
|
88
|
-
return {
|
|
89
|
-
id: 'outline-view-root',
|
|
90
|
-
name: OutlineViewWidget_1.LABEL,
|
|
91
|
-
visible: false,
|
|
92
|
-
children,
|
|
93
|
-
parent: undefined
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Reconcile the outline tree state, gathering all available nodes.
|
|
98
|
-
* @param nodes the list of `TreeNode`.
|
|
99
|
-
*
|
|
100
|
-
* @returns the list of tree nodes.
|
|
101
|
-
*/
|
|
102
|
-
reconcileTreeState(nodes) {
|
|
103
|
-
nodes.forEach(node => {
|
|
104
|
-
if (OutlineSymbolInformationNode.is(node)) {
|
|
105
|
-
const treeNode = this.model.getNode(node.id);
|
|
106
|
-
if (treeNode && OutlineSymbolInformationNode.is(treeNode)) {
|
|
107
|
-
treeNode.expanded = node.expanded;
|
|
108
|
-
treeNode.selected = node.selected;
|
|
109
|
-
}
|
|
110
|
-
this.reconcileTreeState(Array.from(node.children));
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
return nodes;
|
|
114
|
-
}
|
|
115
|
-
onAfterHide(msg) {
|
|
116
|
-
super.onAfterHide(msg);
|
|
117
|
-
this.onDidChangeOpenStateEmitter.fire(false);
|
|
118
|
-
}
|
|
119
|
-
onAfterShow(msg) {
|
|
120
|
-
super.onAfterShow(msg);
|
|
121
|
-
this.onDidChangeOpenStateEmitter.fire(true);
|
|
122
|
-
}
|
|
123
|
-
renderIcon(node, props) {
|
|
124
|
-
if (OutlineSymbolInformationNode.is(node)) {
|
|
125
|
-
return React.createElement("div", { className: 'symbol-icon-center codicon codicon-symbol-' + node.iconClass });
|
|
126
|
-
}
|
|
127
|
-
return undefined;
|
|
128
|
-
}
|
|
129
|
-
createNodeAttributes(node, props) {
|
|
130
|
-
const elementAttrs = super.createNodeAttributes(node, props);
|
|
131
|
-
return Object.assign(Object.assign({}, elementAttrs), { title: this.getNodeTooltip(node) });
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Get the tooltip for the given tree node.
|
|
135
|
-
* - The tooltip is discovered when hovering over a tree node.
|
|
136
|
-
* - If available, the tooltip is the concatenation of the node name, and it's type.
|
|
137
|
-
* @param node the tree node.
|
|
138
|
-
*
|
|
139
|
-
* @returns the tooltip for the tree node if available, else `undefined`.
|
|
140
|
-
*/
|
|
141
|
-
getNodeTooltip(node) {
|
|
142
|
-
if (OutlineSymbolInformationNode.is(node)) {
|
|
143
|
-
return node.name + ` (${node.iconClass})`;
|
|
144
|
-
}
|
|
145
|
-
return undefined;
|
|
146
|
-
}
|
|
147
|
-
isExpandable(node) {
|
|
148
|
-
return OutlineSymbolInformationNode.is(node) && node.children.length > 0;
|
|
149
|
-
}
|
|
150
|
-
renderTree(model) {
|
|
151
|
-
if (browser_1.CompositeTreeNode.is(this.model.root) && !this.model.root.children.length) {
|
|
152
|
-
return React.createElement("div", { className: 'theia-widget-noInfo no-outline' }, nls_1.nls.localizeByDefault('The active editor cannot provide outline information.'));
|
|
153
|
-
}
|
|
154
|
-
return super.renderTree(model);
|
|
155
|
-
}
|
|
156
|
-
deflateForStorage(node) {
|
|
157
|
-
const deflated = super.deflateForStorage(node);
|
|
158
|
-
if (core_1.UriSelection.is(node)) {
|
|
159
|
-
deflated.uri = node.uri.toString();
|
|
160
|
-
}
|
|
161
|
-
return deflated;
|
|
162
|
-
}
|
|
163
|
-
inflateFromStorage(node, parent) {
|
|
164
|
-
const inflated = super.inflateFromStorage(node, parent);
|
|
165
|
-
if (node && 'uri' in node && typeof node.uri === 'string') {
|
|
166
|
-
inflated.uri = new uri_1.default(node.uri);
|
|
167
|
-
}
|
|
168
|
-
return inflated;
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
OutlineViewWidget.LABEL = nls_1.nls.localizeByDefault('Outline');
|
|
172
|
-
OutlineViewWidget = OutlineViewWidget_1 = __decorate([
|
|
173
|
-
(0, inversify_1.injectable)(),
|
|
174
|
-
__param(0, (0, inversify_1.inject)(browser_1.TreeProps)),
|
|
175
|
-
__param(1, (0, inversify_1.inject)(outline_view_tree_model_1.OutlineViewTreeModel)),
|
|
176
|
-
__param(2, (0, inversify_1.inject)(browser_1.ContextMenuRenderer)),
|
|
177
|
-
__metadata("design:paramtypes", [Object, outline_view_tree_model_1.OutlineViewTreeModel,
|
|
178
|
-
browser_1.ContextMenuRenderer])
|
|
179
|
-
], OutlineViewWidget);
|
|
180
|
-
exports.OutlineViewWidget = OutlineViewWidget;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2017-2018 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
+
};
|
|
29
|
+
var OutlineViewWidget_1;
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.OutlineViewWidget = exports.OutlineViewWidgetFactory = exports.OutlineSymbolInformationNode = void 0;
|
|
32
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
33
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
34
|
+
const outline_view_tree_model_1 = require("./outline-view-tree-model");
|
|
35
|
+
const core_1 = require("@theia/core");
|
|
36
|
+
const React = require("@theia/core/shared/react");
|
|
37
|
+
const vscode_languageserver_protocol_1 = require("@theia/core/shared/vscode-languageserver-protocol");
|
|
38
|
+
const uri_1 = require("@theia/core/lib/common/uri");
|
|
39
|
+
const nls_1 = require("@theia/core/lib/common/nls");
|
|
40
|
+
/**
|
|
41
|
+
* Collection of outline symbol information node functions.
|
|
42
|
+
*/
|
|
43
|
+
var OutlineSymbolInformationNode;
|
|
44
|
+
(function (OutlineSymbolInformationNode) {
|
|
45
|
+
/**
|
|
46
|
+
* Determine if the given tree node is an `OutlineSymbolInformationNode`.
|
|
47
|
+
* - The tree node is an `OutlineSymbolInformationNode` if:
|
|
48
|
+
* - The node exists.
|
|
49
|
+
* - The node is selectable.
|
|
50
|
+
* - The node contains a defined `iconClass` property.
|
|
51
|
+
* @param node the tree node.
|
|
52
|
+
*
|
|
53
|
+
* @returns `true` if the given node is an `OutlineSymbolInformationNode`.
|
|
54
|
+
*/
|
|
55
|
+
function is(node) {
|
|
56
|
+
return !!node && browser_1.SelectableTreeNode.is(node) && 'iconClass' in node;
|
|
57
|
+
}
|
|
58
|
+
OutlineSymbolInformationNode.is = is;
|
|
59
|
+
function hasRange(node) {
|
|
60
|
+
return (0, core_1.isObject)(node) && vscode_languageserver_protocol_1.Range.is(node.range);
|
|
61
|
+
}
|
|
62
|
+
OutlineSymbolInformationNode.hasRange = hasRange;
|
|
63
|
+
})(OutlineSymbolInformationNode = exports.OutlineSymbolInformationNode || (exports.OutlineSymbolInformationNode = {}));
|
|
64
|
+
exports.OutlineViewWidgetFactory = Symbol('OutlineViewWidgetFactory');
|
|
65
|
+
let OutlineViewWidget = OutlineViewWidget_1 = class OutlineViewWidget extends browser_1.TreeWidget {
|
|
66
|
+
constructor(treeProps, model, contextMenuRenderer) {
|
|
67
|
+
super(treeProps, model, contextMenuRenderer);
|
|
68
|
+
this.model = model;
|
|
69
|
+
this.onDidChangeOpenStateEmitter = new core_1.Emitter();
|
|
70
|
+
this.id = 'outline-view';
|
|
71
|
+
this.title.label = OutlineViewWidget_1.LABEL;
|
|
72
|
+
this.title.caption = OutlineViewWidget_1.LABEL;
|
|
73
|
+
this.title.closable = true;
|
|
74
|
+
this.title.iconClass = (0, browser_1.codicon)('symbol-class');
|
|
75
|
+
this.addClass('theia-outline-view');
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Set the outline tree with the list of `OutlineSymbolInformationNode`.
|
|
79
|
+
* @param roots the list of `OutlineSymbolInformationNode`.
|
|
80
|
+
*/
|
|
81
|
+
setOutlineTree(roots) {
|
|
82
|
+
// Gather the list of available nodes.
|
|
83
|
+
const nodes = this.reconcileTreeState(roots);
|
|
84
|
+
// Update the model root node, appending the outline symbol information nodes as children.
|
|
85
|
+
this.model.root = this.getRoot(nodes);
|
|
86
|
+
}
|
|
87
|
+
getRoot(children) {
|
|
88
|
+
return {
|
|
89
|
+
id: 'outline-view-root',
|
|
90
|
+
name: OutlineViewWidget_1.LABEL,
|
|
91
|
+
visible: false,
|
|
92
|
+
children,
|
|
93
|
+
parent: undefined
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Reconcile the outline tree state, gathering all available nodes.
|
|
98
|
+
* @param nodes the list of `TreeNode`.
|
|
99
|
+
*
|
|
100
|
+
* @returns the list of tree nodes.
|
|
101
|
+
*/
|
|
102
|
+
reconcileTreeState(nodes) {
|
|
103
|
+
nodes.forEach(node => {
|
|
104
|
+
if (OutlineSymbolInformationNode.is(node)) {
|
|
105
|
+
const treeNode = this.model.getNode(node.id);
|
|
106
|
+
if (treeNode && OutlineSymbolInformationNode.is(treeNode)) {
|
|
107
|
+
treeNode.expanded = node.expanded;
|
|
108
|
+
treeNode.selected = node.selected;
|
|
109
|
+
}
|
|
110
|
+
this.reconcileTreeState(Array.from(node.children));
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return nodes;
|
|
114
|
+
}
|
|
115
|
+
onAfterHide(msg) {
|
|
116
|
+
super.onAfterHide(msg);
|
|
117
|
+
this.onDidChangeOpenStateEmitter.fire(false);
|
|
118
|
+
}
|
|
119
|
+
onAfterShow(msg) {
|
|
120
|
+
super.onAfterShow(msg);
|
|
121
|
+
this.onDidChangeOpenStateEmitter.fire(true);
|
|
122
|
+
}
|
|
123
|
+
renderIcon(node, props) {
|
|
124
|
+
if (OutlineSymbolInformationNode.is(node)) {
|
|
125
|
+
return React.createElement("div", { className: 'symbol-icon-center codicon codicon-symbol-' + node.iconClass });
|
|
126
|
+
}
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
createNodeAttributes(node, props) {
|
|
130
|
+
const elementAttrs = super.createNodeAttributes(node, props);
|
|
131
|
+
return Object.assign(Object.assign({}, elementAttrs), { title: this.getNodeTooltip(node) });
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Get the tooltip for the given tree node.
|
|
135
|
+
* - The tooltip is discovered when hovering over a tree node.
|
|
136
|
+
* - If available, the tooltip is the concatenation of the node name, and it's type.
|
|
137
|
+
* @param node the tree node.
|
|
138
|
+
*
|
|
139
|
+
* @returns the tooltip for the tree node if available, else `undefined`.
|
|
140
|
+
*/
|
|
141
|
+
getNodeTooltip(node) {
|
|
142
|
+
if (OutlineSymbolInformationNode.is(node)) {
|
|
143
|
+
return node.name + ` (${node.iconClass})`;
|
|
144
|
+
}
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
isExpandable(node) {
|
|
148
|
+
return OutlineSymbolInformationNode.is(node) && node.children.length > 0;
|
|
149
|
+
}
|
|
150
|
+
renderTree(model) {
|
|
151
|
+
if (browser_1.CompositeTreeNode.is(this.model.root) && !this.model.root.children.length) {
|
|
152
|
+
return React.createElement("div", { className: 'theia-widget-noInfo no-outline' }, nls_1.nls.localizeByDefault('The active editor cannot provide outline information.'));
|
|
153
|
+
}
|
|
154
|
+
return super.renderTree(model);
|
|
155
|
+
}
|
|
156
|
+
deflateForStorage(node) {
|
|
157
|
+
const deflated = super.deflateForStorage(node);
|
|
158
|
+
if (core_1.UriSelection.is(node)) {
|
|
159
|
+
deflated.uri = node.uri.toString();
|
|
160
|
+
}
|
|
161
|
+
return deflated;
|
|
162
|
+
}
|
|
163
|
+
inflateFromStorage(node, parent) {
|
|
164
|
+
const inflated = super.inflateFromStorage(node, parent);
|
|
165
|
+
if (node && 'uri' in node && typeof node.uri === 'string') {
|
|
166
|
+
inflated.uri = new uri_1.default(node.uri);
|
|
167
|
+
}
|
|
168
|
+
return inflated;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
OutlineViewWidget.LABEL = nls_1.nls.localizeByDefault('Outline');
|
|
172
|
+
OutlineViewWidget = OutlineViewWidget_1 = __decorate([
|
|
173
|
+
(0, inversify_1.injectable)(),
|
|
174
|
+
__param(0, (0, inversify_1.inject)(browser_1.TreeProps)),
|
|
175
|
+
__param(1, (0, inversify_1.inject)(outline_view_tree_model_1.OutlineViewTreeModel)),
|
|
176
|
+
__param(2, (0, inversify_1.inject)(browser_1.ContextMenuRenderer)),
|
|
177
|
+
__metadata("design:paramtypes", [Object, outline_view_tree_model_1.OutlineViewTreeModel,
|
|
178
|
+
browser_1.ContextMenuRenderer])
|
|
179
|
+
], OutlineViewWidget);
|
|
180
|
+
exports.OutlineViewWidget = OutlineViewWidget;
|
|
181
181
|
//# sourceMappingURL=outline-view-widget.js.map
|