@theia/typehierarchy 1.67.0-next.56 → 1.67.0-next.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/lib/browser/index.d.ts +5 -0
  2. package/lib/browser/index.d.ts.map +1 -0
  3. package/lib/browser/index.js +23 -0
  4. package/lib/browser/index.js.map +1 -0
  5. package/lib/browser/tree/typehierarchy-tree-container.d.ts +4 -0
  6. package/lib/browser/tree/typehierarchy-tree-container.d.ts.map +1 -0
  7. package/lib/browser/tree/typehierarchy-tree-container.js +35 -0
  8. package/lib/browser/tree/typehierarchy-tree-container.js.map +1 -0
  9. package/lib/browser/tree/typehierarchy-tree-model.d.ts +17 -0
  10. package/lib/browser/tree/typehierarchy-tree-model.d.ts.map +1 -0
  11. package/lib/browser/tree/typehierarchy-tree-model.js +85 -0
  12. package/lib/browser/tree/typehierarchy-tree-model.js.map +1 -0
  13. package/lib/browser/tree/typehierarchy-tree-widget.d.ts +37 -0
  14. package/lib/browser/tree/typehierarchy-tree-widget.d.ts.map +1 -0
  15. package/lib/browser/tree/typehierarchy-tree-widget.js +108 -0
  16. package/lib/browser/tree/typehierarchy-tree-widget.js.map +1 -0
  17. package/lib/browser/tree/typehierarchy-tree.d.ts +39 -0
  18. package/lib/browser/tree/typehierarchy-tree.d.ts.map +1 -0
  19. package/lib/browser/tree/typehierarchy-tree.js +169 -0
  20. package/lib/browser/tree/typehierarchy-tree.js.map +1 -0
  21. package/lib/browser/typehierarchy-contribution.d.ts +50 -0
  22. package/lib/browser/typehierarchy-contribution.d.ts.map +1 -0
  23. package/lib/browser/typehierarchy-contribution.js +165 -0
  24. package/lib/browser/typehierarchy-contribution.js.map +1 -0
  25. package/lib/browser/typehierarchy-frontend-module.d.ts +5 -0
  26. package/lib/browser/typehierarchy-frontend-module.d.ts.map +1 -0
  27. package/lib/browser/typehierarchy-frontend-module.js +38 -0
  28. package/lib/browser/typehierarchy-frontend-module.js.map +1 -0
  29. package/lib/browser/typehierarchy-provider.d.ts +105 -0
  30. package/lib/browser/typehierarchy-provider.d.ts.map +1 -0
  31. package/lib/browser/typehierarchy-provider.js +42 -0
  32. package/lib/browser/typehierarchy-provider.js.map +1 -0
  33. package/lib/browser/typehierarchy-service.d.ts +29 -0
  34. package/lib/browser/typehierarchy-service.d.ts.map +1 -0
  35. package/lib/browser/typehierarchy-service.js +78 -0
  36. package/lib/browser/typehierarchy-service.js.map +1 -0
  37. package/lib/browser/typehierarchy.d.ts +14 -0
  38. package/lib/browser/typehierarchy.d.ts.map +1 -0
  39. package/lib/browser/typehierarchy.js +18 -0
  40. package/lib/browser/typehierarchy.js.map +1 -0
  41. package/lib/package.spec.d.ts +1 -0
  42. package/lib/package.spec.d.ts.map +1 -0
  43. package/lib/package.spec.js +26 -0
  44. package/lib/package.spec.js.map +1 -0
  45. package/package.json +4 -4
@@ -0,0 +1,5 @@
1
+ export * from './typehierarchy';
2
+ export * from './typehierarchy-contribution';
3
+ export * from './typehierarchy-frontend-module';
4
+ export * from './typehierarchy-service';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAgBA,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2022 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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const tslib_1 = require("tslib");
19
+ tslib_1.__exportStar(require("./typehierarchy"), exports);
20
+ tslib_1.__exportStar(require("./typehierarchy-contribution"), exports);
21
+ tslib_1.__exportStar(require("./typehierarchy-frontend-module"), exports);
22
+ tslib_1.__exportStar(require("./typehierarchy-service"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,0DAAgC;AAChC,uEAA6C;AAC7C,0EAAgD;AAChD,kEAAwC"}
@@ -0,0 +1,4 @@
1
+ import { interfaces } from '@theia/core/shared/inversify';
2
+ import { TypeHierarchyTreeWidget } from './typehierarchy-tree-widget';
3
+ export declare function createHierarchyTreeWidget(parent: interfaces.Container): TypeHierarchyTreeWidget;
4
+ //# sourceMappingURL=typehierarchy-tree-container.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typehierarchy-tree-container.d.ts","sourceRoot":"","sources":["../../../src/browser/tree/typehierarchy-tree-container.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAa,MAAM,8BAA8B,CAAC;AAIrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAYtE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,UAAU,CAAC,SAAS,GAAG,uBAAuB,CAE/F"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2019 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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.createHierarchyTreeWidget = void 0;
19
+ const tree_1 = require("@theia/core/lib/browser/tree");
20
+ const typehierarchy_tree_1 = require("./typehierarchy-tree");
21
+ const typehierarchy_tree_model_1 = require("./typehierarchy-tree-model");
22
+ const typehierarchy_tree_widget_1 = require("./typehierarchy-tree-widget");
23
+ function createHierarchyTreeContainer(parent) {
24
+ const child = (0, tree_1.createTreeContainer)(parent, {
25
+ tree: typehierarchy_tree_1.TypeHierarchyTree,
26
+ model: typehierarchy_tree_model_1.TypeHierarchyTreeModel,
27
+ widget: typehierarchy_tree_widget_1.TypeHierarchyTreeWidget
28
+ });
29
+ return child;
30
+ }
31
+ function createHierarchyTreeWidget(parent) {
32
+ return createHierarchyTreeContainer(parent).get(typehierarchy_tree_widget_1.TypeHierarchyTreeWidget);
33
+ }
34
+ exports.createHierarchyTreeWidget = createHierarchyTreeWidget;
35
+ //# sourceMappingURL=typehierarchy-tree-container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typehierarchy-tree-container.js","sourceRoot":"","sources":["../../../src/browser/tree/typehierarchy-tree-container.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAGhF,uDAAoE;AACpE,6DAAyD;AACzD,yEAAoE;AACpE,2EAAsE;AAEtE,SAAS,4BAA4B,CAAC,MAA4B;IAC9D,MAAM,KAAK,GAAG,IAAA,0BAAmB,EAAC,MAAM,EAAE;QACtC,IAAI,EAAE,sCAAiB;QACvB,KAAK,EAAE,iDAAsB;QAC7B,MAAM,EAAE,mDAAuB;KAClC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAgB,yBAAyB,CAAC,MAA4B;IAClE,OAAO,4BAA4B,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,mDAAuB,CAAC,CAAC;AAC7E,CAAC;AAFD,8DAEC"}
@@ -0,0 +1,17 @@
1
+ import { TreeNode } from '@theia/core/lib/browser/tree/tree';
2
+ import { TreeModelImpl } from '@theia/core/lib/browser/tree/tree-model';
3
+ import { TypeHierarchyRegistry } from '../typehierarchy-provider';
4
+ import { TypeHierarchyTree } from './typehierarchy-tree';
5
+ export declare class TypeHierarchyTreeModel extends TreeModelImpl {
6
+ protected readonly registry: TypeHierarchyRegistry;
7
+ protected doOpenNode(node: TreeNode): void;
8
+ /**
9
+ * Initializes the tree by calculating and setting a new tree root node.
10
+ */
11
+ initialize(options: TypeHierarchyTree.InitOptions): Promise<void>;
12
+ /**
13
+ * If the tree root is set, it resets it with the inverse type hierarchy direction.
14
+ */
15
+ flipDirection(): Promise<void>;
16
+ }
17
+ //# sourceMappingURL=typehierarchy-tree-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typehierarchy-tree-model.d.ts","sourceRoot":"","sources":["../../../src/browser/tree/typehierarchy-tree-model.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAA+C,MAAM,2BAA2B,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,qBACa,sBAAuB,SAAQ,aAAa;IAGrD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;cAEhC,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAInD;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,iBAAiB,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BvE;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CAkBvC"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2019 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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.TypeHierarchyTreeModel = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const tree_model_1 = require("@theia/core/lib/browser/tree/tree-model");
22
+ const typehierarchy_provider_1 = require("../typehierarchy-provider");
23
+ const typehierarchy_tree_1 = require("./typehierarchy-tree");
24
+ let TypeHierarchyTreeModel = class TypeHierarchyTreeModel extends tree_model_1.TreeModelImpl {
25
+ doOpenNode(node) {
26
+ // do nothing (in particular do not expand the node)
27
+ }
28
+ /**
29
+ * Initializes the tree by calculating and setting a new tree root node.
30
+ */
31
+ async initialize(options) {
32
+ this.tree.root = undefined;
33
+ this.tree.provider = undefined;
34
+ const { location, languageId, direction } = options;
35
+ if (languageId && location) {
36
+ const provider = await this.registry.get(languageId);
37
+ if (provider) {
38
+ const params = {
39
+ textDocument: {
40
+ uri: location.uri
41
+ },
42
+ position: location.range.start,
43
+ direction,
44
+ resolve: 1
45
+ };
46
+ const symbol = await provider.get(params);
47
+ if (symbol) {
48
+ const root = typehierarchy_tree_1.TypeHierarchyTree.RootNode.create(symbol, direction);
49
+ root.expanded = true;
50
+ this.tree.root = root;
51
+ this.tree.provider = provider;
52
+ }
53
+ }
54
+ }
55
+ }
56
+ /**
57
+ * If the tree root is set, it resets it with the inverse type hierarchy direction.
58
+ */
59
+ async flipDirection() {
60
+ const { root } = this.tree;
61
+ const service = this.tree.provider;
62
+ if (typehierarchy_tree_1.TypeHierarchyTree.RootNode.is(root) && !!service) {
63
+ const { direction, item } = root;
64
+ const { uri, selectionRange } = item;
65
+ const location = {
66
+ uri,
67
+ range: selectionRange
68
+ };
69
+ this.initialize({
70
+ direction: direction === 0 /* TypeHierarchyDirection.Children */ ? 1 /* TypeHierarchyDirection.Parents */ : 0 /* TypeHierarchyDirection.Children */,
71
+ location,
72
+ languageId: service.languageId
73
+ });
74
+ }
75
+ }
76
+ };
77
+ exports.TypeHierarchyTreeModel = TypeHierarchyTreeModel;
78
+ tslib_1.__decorate([
79
+ (0, inversify_1.inject)(typehierarchy_provider_1.TypeHierarchyRegistry),
80
+ tslib_1.__metadata("design:type", typehierarchy_provider_1.TypeHierarchyRegistry)
81
+ ], TypeHierarchyTreeModel.prototype, "registry", void 0);
82
+ exports.TypeHierarchyTreeModel = TypeHierarchyTreeModel = tslib_1.__decorate([
83
+ (0, inversify_1.injectable)()
84
+ ], TypeHierarchyTreeModel);
85
+ //# sourceMappingURL=typehierarchy-tree-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typehierarchy-tree-model.js","sourceRoot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AI,CAAC,QAAQ,GAAG,IAAI,CAAC;oBACrB,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;oBACrB,IAAI,CAAC,IAA0B,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBACzD,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa;QACf,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;QAC3B,MAAM,OAAO,GAAI,IAAI,CAAC,IAA0B,CAAC,QAAQ,CAAC;QAC1D,IAAI,sCAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;YACnD,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;YACjC,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;YACrC,MAAM,QAAQ,GAAG;gBACb,GAAG;gBACH,KAAK,EAAE,cAAc;aACxB,CAAC;YACF,IAAI,CAAC,UAAU,CAAC;gBACZ,SAAS,EAAE,SAAS,4CAAoC,CAAC,CAAC,wCAAgC,CAAC,wCAAgC;gBAC3H,QAAQ;gBACR,UAAU,EAAE,OAAO,CAAC,UAAU;aACjC,CAAC,CAAC;QACP,CAAC;IACL,CAAC;CAEJ,CAAA;AA3DY,wDAAsB;AAGZ;IADlB,IAAA,kBAAM,EAAC,8CAAqB,CAAC;sCACD,8CAAqB;wDAAC;iCAH1C,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CA2DlC"}
@@ -0,0 +1,37 @@
1
+ /// <reference types="react" />
2
+ import * as React from '@theia/core/shared/react';
3
+ import { TreeNode } from '@theia/core/lib/browser/tree/tree';
4
+ import { EditorManager } from '@theia/editor/lib/browser/editor-manager';
5
+ import { ContextMenuRenderer } from '@theia/core/lib/browser/context-menu-renderer';
6
+ import { TreeWidget, TreeProps } from '@theia/core/lib/browser/tree/tree-widget';
7
+ import { TypeHierarchyTreeModel } from './typehierarchy-tree-model';
8
+ import { TypeHierarchyTree } from './typehierarchy-tree';
9
+ export declare class TypeHierarchyTreeWidget extends TreeWidget {
10
+ readonly model: TypeHierarchyTreeModel;
11
+ protected readonly icons: Map<number, string>;
12
+ readonly editorManager: EditorManager;
13
+ constructor(props: TreeProps, model: TypeHierarchyTreeModel, contextMenuRenderer: ContextMenuRenderer);
14
+ /**
15
+ * Initializes the widget with the new input.
16
+ */
17
+ initialize(options: TypeHierarchyTree.InitOptions): Promise<void>;
18
+ /**
19
+ * See: `TreeWidget#renderIcon`.
20
+ */
21
+ protected renderIcon(node: TreeNode): React.ReactNode;
22
+ /**
23
+ * Opens up the node in the editor. On demand (`keepFocus`) it reveals the location in the editor.
24
+ */
25
+ protected openEditor(node: TreeNode, keepFocus?: boolean): Promise<void>;
26
+ }
27
+ export declare namespace TypeHierarchyTreeWidget {
28
+ const WIDGET_ID = "theia-typehierarchy";
29
+ const WIDGET_LABEL: string;
30
+ /**
31
+ * CSS styles for the `Type Hierarchy` widget.
32
+ */
33
+ namespace Styles {
34
+ const TYPE_HIERARCHY_TREE_CLASS = "theia-type-hierarchy-tree";
35
+ }
36
+ }
37
+ //# sourceMappingURL=typehierarchy-tree-widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typehierarchy-tree-widget.d.ts","sourceRoot":"","sources":["../../../src/browser/tree/typehierarchy-tree-widget.tsx"],"names":[],"mappings":";AAgBA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAKlD,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,qBACa,uBAAwB,SAAQ,UAAU;aASG,KAAK,EAAE,sBAAsB;IANnF,SAAS,CAAC,QAAQ,CAAC,KAAK,sBAAoI;IAErI,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;gBAGtC,KAAK,EAAE,SAAS,EACe,KAAK,EAAE,sBAAsB,EAClD,mBAAmB,EAAE,mBAAmB;IAkBzE;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,iBAAiB,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvE;;OAEG;cACgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC,SAAS;IAO9D;;OAEG;cACa,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAaxF;AAED,yBAAiB,uBAAuB,CAAC;IAE9B,MAAM,SAAS,wBAAwB,CAAC;IACxC,MAAM,YAAY,QAA0C,CAAC;IAEpE;;OAEG;IACH,UAAiB,MAAM,CAAC;QAEb,MAAM,yBAAyB,8BAA8B,CAAC;KAExE;CACJ"}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2019 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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var TypeHierarchyTreeWidget_1;
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.TypeHierarchyTreeWidget = void 0;
20
+ const tslib_1 = require("tslib");
21
+ const React = require("@theia/core/shared/react");
22
+ const inversify_1 = require("@theia/core/shared/inversify");
23
+ const widgets_1 = require("@theia/core/shared/@lumino/widgets");
24
+ const uri_1 = require("@theia/core/lib/common/uri");
25
+ const vscode_languageserver_protocol_1 = require("@theia/core/shared/vscode-languageserver-protocol");
26
+ const editor_manager_1 = require("@theia/editor/lib/browser/editor-manager");
27
+ const context_menu_renderer_1 = require("@theia/core/lib/browser/context-menu-renderer");
28
+ const tree_widget_1 = require("@theia/core/lib/browser/tree/tree-widget");
29
+ const typehierarchy_tree_model_1 = require("./typehierarchy-tree-model");
30
+ const typehierarchy_tree_1 = require("./typehierarchy-tree");
31
+ const browser_1 = require("@theia/core/lib/browser");
32
+ const nls_1 = require("@theia/core/lib/common/nls");
33
+ let TypeHierarchyTreeWidget = TypeHierarchyTreeWidget_1 = class TypeHierarchyTreeWidget extends tree_widget_1.TreeWidget {
34
+ constructor(props, model, contextMenuRenderer) {
35
+ super(props, model, contextMenuRenderer);
36
+ this.model = model;
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ this.icons = new Map(Array.from(Object.keys(vscode_languageserver_protocol_1.SymbolKind)).map(key => [vscode_languageserver_protocol_1.SymbolKind[key], key.toLocaleLowerCase()]));
39
+ this.id = TypeHierarchyTreeWidget_1.WIDGET_ID;
40
+ this.title.label = TypeHierarchyTreeWidget_1.WIDGET_LABEL;
41
+ this.title.caption = TypeHierarchyTreeWidget_1.WIDGET_LABEL;
42
+ this.addClass(TypeHierarchyTreeWidget_1.Styles.TYPE_HIERARCHY_TREE_CLASS);
43
+ this.title.closable = true;
44
+ this.title.iconClass = (0, browser_1.codicon)('type-hierarchy');
45
+ this.toDispose.push(this.model.onSelectionChanged(selection => {
46
+ const node = selection[0];
47
+ if (node) {
48
+ this.openEditor(node, true);
49
+ }
50
+ }));
51
+ this.toDispose.push(this.model.onOpenNode(node => this.openEditor(node)));
52
+ }
53
+ /**
54
+ * Initializes the widget with the new input.
55
+ */
56
+ async initialize(options) {
57
+ await this.model.initialize(options);
58
+ }
59
+ /**
60
+ * See: `TreeWidget#renderIcon`.
61
+ */
62
+ renderIcon(node) {
63
+ if (typehierarchy_tree_1.TypeHierarchyTree.Node.is(node)) {
64
+ return React.createElement("div", { className: 'symbol-icon-center codicon codicon-symbol-' + this.icons.get(node.item.kind) || 'unknown' });
65
+ }
66
+ return undefined;
67
+ }
68
+ /**
69
+ * Opens up the node in the editor. On demand (`keepFocus`) it reveals the location in the editor.
70
+ */
71
+ async openEditor(node, keepFocus = false) {
72
+ if (typehierarchy_tree_1.TypeHierarchyTree.Node.is(node)) {
73
+ const { selectionRange, uri } = node.item;
74
+ const editorWidget = await this.editorManager.open(new uri_1.default(uri), {
75
+ mode: keepFocus ? 'reveal' : 'activate',
76
+ selection: vscode_languageserver_protocol_1.Range.create(selectionRange.start, selectionRange.end)
77
+ });
78
+ if (editorWidget.parent instanceof widgets_1.DockPanel) {
79
+ editorWidget.parent.selectWidget(editorWidget);
80
+ }
81
+ }
82
+ }
83
+ };
84
+ exports.TypeHierarchyTreeWidget = TypeHierarchyTreeWidget;
85
+ tslib_1.__decorate([
86
+ (0, inversify_1.inject)(editor_manager_1.EditorManager),
87
+ tslib_1.__metadata("design:type", editor_manager_1.EditorManager)
88
+ ], TypeHierarchyTreeWidget.prototype, "editorManager", void 0);
89
+ exports.TypeHierarchyTreeWidget = TypeHierarchyTreeWidget = TypeHierarchyTreeWidget_1 = tslib_1.__decorate([
90
+ (0, inversify_1.injectable)(),
91
+ tslib_1.__param(0, (0, inversify_1.inject)(tree_widget_1.TreeProps)),
92
+ tslib_1.__param(1, (0, inversify_1.inject)(typehierarchy_tree_model_1.TypeHierarchyTreeModel)),
93
+ tslib_1.__param(2, (0, inversify_1.inject)(context_menu_renderer_1.ContextMenuRenderer)),
94
+ tslib_1.__metadata("design:paramtypes", [Object, typehierarchy_tree_model_1.TypeHierarchyTreeModel,
95
+ context_menu_renderer_1.ContextMenuRenderer])
96
+ ], TypeHierarchyTreeWidget);
97
+ (function (TypeHierarchyTreeWidget) {
98
+ TypeHierarchyTreeWidget.WIDGET_ID = 'theia-typehierarchy';
99
+ TypeHierarchyTreeWidget.WIDGET_LABEL = nls_1.nls.localizeByDefault('Type Hierarchy');
100
+ /**
101
+ * CSS styles for the `Type Hierarchy` widget.
102
+ */
103
+ let Styles;
104
+ (function (Styles) {
105
+ Styles.TYPE_HIERARCHY_TREE_CLASS = 'theia-type-hierarchy-tree';
106
+ })(Styles = TypeHierarchyTreeWidget.Styles || (TypeHierarchyTreeWidget.Styles = {}));
107
+ })(TypeHierarchyTreeWidget || (exports.TypeHierarchyTreeWidget = TypeHierarchyTreeWidget = {}));
108
+ //# sourceMappingURL=typehierarchy-tree-widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typehierarchy-tree-widget.js","sourceRoot":"","sources":["../../../src/browser/tree/typehierarchy-tree-widget.tsx"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;;AAEhF,kDAAkD;AAClD,4DAAkE;AAClE,gEAA+D;AAC/D,oDAA6C;AAC7C,sGAAsF;AAEtF,6EAAyE;AACzE,yFAAoF;AACpF,0EAAiF;AACjF,yEAAoE;AACpE,6DAAyD;AACzD,qDAAkD;AAClD,oDAAiD;AAG1C,IAAM,uBAAuB,+BAA7B,MAAM,uBAAwB,SAAQ,wBAAU;IAOnD,YACuB,KAAgB,EACH,KAA+C,EAClD,mBAAwC;QAErE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC;QAHS,UAAK,GAAL,KAAK,CA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AA,IAAA,kBAAM,EAAC,2CAAmB,CAAC,CAAA;qDAD6B,iDAAsB;QAC7B,2CAAmB;GAVhE,uBAAuB,CA6DnC;AAED,WAAiB,uBAAuB;IAEvB,iCAAS,GAAG,qBAAqB,CAAC;IAClC,oCAAY,GAAG,SAAG,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAEpE;;OAEG;IACH,IAAiB,MAAM,CAItB;IAJD,WAAiB,MAAM;QAEN,gCAAyB,GAAG,2BAA2B,CAAC;IAEzE,CAAC,EAJgB,MAAM,GAAN,8BAAM,KAAN,8BAAM,QAItB;AACL,CAAC,EAbgB,uBAAuB,uCAAvB,uBAAuB,QAavC"}
@@ -0,0 +1,39 @@
1
+ import { Location } from '@theia/editor/lib/browser/editor';
2
+ import { DecoratedTreeNode } from '@theia/core/lib/browser/tree/tree-decorator';
3
+ import { TreeImpl, TreeNode, CompositeTreeNode, ExpandableTreeNode, SelectableTreeNode } from '@theia/core/lib/browser/tree';
4
+ import { TypeHierarchyProvider, TypeHierarchyDirection, TypeHierarchyItem } from '../typehierarchy-provider';
5
+ export declare class TypeHierarchyTree extends TreeImpl {
6
+ provider: TypeHierarchyProvider | undefined;
7
+ resolveChildren(parent: CompositeTreeNode): Promise<TreeNode[]>;
8
+ /**
9
+ * Returns with the direction of the type hierarchy attached to the root node. `undefined` if the root is not set.
10
+ */
11
+ protected get direction(): TypeHierarchyDirection | undefined;
12
+ /**
13
+ * Makes sure, the node and its children are resolved. Resolves it on demand.
14
+ */
15
+ protected ensureResolved(node: TypeHierarchyTree.Node): Promise<void>;
16
+ }
17
+ export declare namespace TypeHierarchyTree {
18
+ interface InitOptions {
19
+ readonly direction: TypeHierarchyDirection;
20
+ readonly location: Location | undefined;
21
+ readonly languageId: string | undefined;
22
+ }
23
+ interface RootNode extends Node {
24
+ readonly direction: TypeHierarchyDirection;
25
+ }
26
+ namespace RootNode {
27
+ function is(node: TreeNode | undefined): node is RootNode;
28
+ function create(item: TypeHierarchyItem, direction: TypeHierarchyDirection): RootNode;
29
+ }
30
+ interface Node extends CompositeTreeNode, ExpandableTreeNode, SelectableTreeNode, DecoratedTreeNode {
31
+ readonly item: TypeHierarchyItem;
32
+ resolved: boolean;
33
+ }
34
+ namespace Node {
35
+ function is(node: TreeNode | undefined): node is Node;
36
+ function create(item: TypeHierarchyItem, direction: TypeHierarchyDirection, resolved?: boolean): Node;
37
+ }
38
+ }
39
+ //# sourceMappingURL=typehierarchy-tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typehierarchy-tree.d.ts","sourceRoot":"","sources":["../../../src/browser/tree/typehierarchy-tree.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAkB,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC7H,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAkC,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE7I,qBACa,iBAAkB,SAAQ,QAAQ;IAE3C,QAAQ,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAE7B,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAa9E;;OAEG;IACH,SAAS,KAAK,SAAS,IAAI,sBAAsB,GAAG,SAAS,CAK5D;IAED;;OAEG;cACa,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAwB9E;AAED,yBAAiB,iBAAiB,CAAC;IAE/B,UAAiB,WAAW;QACxB,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;QAC3C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;QACxC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;KAC3C;IAED,UAAiB,QAAS,SAAQ,IAAI;QAClC,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;KAC9C;IAED,UAAiB,QAAQ,CAAC;QAEtB,SAAgB,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,IAAI,IAAI,QAAQ,CAM/D;QAED,SAAgB,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,SAAS,EAAE,sBAAsB,GAAG,QAAQ,CAK3F;KAEJ;IAED,UAAiB,IAAK,SAAQ,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB;QACtG,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;QACjC,QAAQ,EAAE,OAAO,CAAC;KACrB;IAED,UAAiB,IAAI,CAAC;QAElB,SAAgB,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,IAAI,IAAI,IAAI,CAM3D;QAED,SAAgB,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,SAAS,EAAE,sBAAsB,EAAE,QAAQ,GAAE,OAAc,GAAG,IAAI,CA0BjH;KAgCJ;CAEJ"}
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2019 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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var TypeHierarchyTree_1;
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.TypeHierarchyTree = void 0;
20
+ const tslib_1 = require("tslib");
21
+ /* eslint-disable @typescript-eslint/no-explicit-any */
22
+ const inversify_1 = require("@theia/core/shared/inversify");
23
+ const uuid_1 = require("@theia/core/lib/common/uuid");
24
+ const uri_1 = require("@theia/core/lib/common/uri");
25
+ const editor_1 = require("@theia/editor/lib/browser/editor");
26
+ const tree_1 = require("@theia/core/lib/browser/tree");
27
+ let TypeHierarchyTree = TypeHierarchyTree_1 = class TypeHierarchyTree extends tree_1.TreeImpl {
28
+ async resolveChildren(parent) {
29
+ if (TypeHierarchyTree_1.Node.is(parent)) {
30
+ await this.ensureResolved(parent);
31
+ if (parent.children.length === 0) {
32
+ delete parent.children;
33
+ delete parent.expanded;
34
+ return [];
35
+ }
36
+ return parent.children.slice();
37
+ }
38
+ return [];
39
+ }
40
+ /**
41
+ * Returns with the direction of the type hierarchy attached to the root node. `undefined` if the root is not set.
42
+ */
43
+ get direction() {
44
+ if (TypeHierarchyTree_1.RootNode.is(this.root)) {
45
+ return this.root.direction;
46
+ }
47
+ return undefined;
48
+ }
49
+ /**
50
+ * Makes sure, the node and its children are resolved. Resolves it on demand.
51
+ */
52
+ async ensureResolved(node) {
53
+ if (!node.resolved) {
54
+ const { provider, direction } = this;
55
+ if (provider && direction !== undefined) {
56
+ const { item } = node;
57
+ const param = {
58
+ item,
59
+ direction,
60
+ resolve: 1
61
+ };
62
+ const resolvedItem = await provider.resolve(param);
63
+ if (resolvedItem) {
64
+ node.resolved = true;
65
+ const items = 0 /* TypeHierarchyDirection.Children */ === direction ? resolvedItem.children : resolvedItem.parents;
66
+ if (items) {
67
+ node.children = items.map(child => TypeHierarchyTree_1.Node.create(child, direction, false));
68
+ }
69
+ else {
70
+ node.children = [];
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ };
77
+ exports.TypeHierarchyTree = TypeHierarchyTree;
78
+ exports.TypeHierarchyTree = TypeHierarchyTree = TypeHierarchyTree_1 = tslib_1.__decorate([
79
+ (0, inversify_1.injectable)()
80
+ ], TypeHierarchyTree);
81
+ (function (TypeHierarchyTree) {
82
+ let RootNode;
83
+ (function (RootNode) {
84
+ function is(node) {
85
+ if (Node.is(node) && 'direction' in node) {
86
+ const { direction } = node;
87
+ return direction === 0 /* TypeHierarchyDirection.Children */ || direction === 1 /* TypeHierarchyDirection.Parents */;
88
+ }
89
+ return false;
90
+ }
91
+ RootNode.is = is;
92
+ function create(item, direction) {
93
+ return {
94
+ ...Node.create(item, direction, true),
95
+ direction
96
+ };
97
+ }
98
+ RootNode.create = create;
99
+ })(RootNode = TypeHierarchyTree.RootNode || (TypeHierarchyTree.RootNode = {}));
100
+ let Node;
101
+ (function (Node) {
102
+ function is(node) {
103
+ if (!!node && 'resolved' in node && 'item' in node) {
104
+ const { resolved, item } = node;
105
+ return typeof resolved === 'boolean' && !!item;
106
+ }
107
+ return false;
108
+ }
109
+ Node.is = is;
110
+ function create(item, direction, resolved = true) {
111
+ const items = 0 /* TypeHierarchyDirection.Children */ === direction ? item.children : item.parents;
112
+ if (items && items.length > 0) {
113
+ // If the server sent more levels than requested, use them.
114
+ resolved = true;
115
+ }
116
+ const node = {
117
+ id: (0, uuid_1.generateUuid)(),
118
+ name: item.name,
119
+ description: item.detail,
120
+ parent: undefined,
121
+ location: editor_1.Location.create(item.uri, item.selectionRange),
122
+ resolved,
123
+ children: items ? items.map(child => create(child, direction, false)) : [],
124
+ expanded: false,
125
+ visible: true,
126
+ selected: false,
127
+ kind: item.kind,
128
+ decorationData: decorationData(item, direction),
129
+ item
130
+ };
131
+ // Trick: if the node is `resolved` and have zero `children`, make the node non-expandable.
132
+ if (resolved && node.children.length === 0) {
133
+ delete node.expanded;
134
+ }
135
+ return node;
136
+ }
137
+ Node.create = create;
138
+ function decorationData(item, direction) {
139
+ const captionSuffixes = [{
140
+ data: new uri_1.default(item.uri).displayName,
141
+ fontData: {
142
+ color: 'var(--theia-descriptionForeground)',
143
+ }
144
+ }];
145
+ if (item.detail) {
146
+ captionSuffixes.unshift({
147
+ data: item.detail,
148
+ fontData: {
149
+ color: 'var(--theia-list-highlightForeground)',
150
+ style: 'italic'
151
+ }
152
+ });
153
+ }
154
+ const data = `${0 /* TypeHierarchyDirection.Children */ === direction ? '▼' : '▲'}`;
155
+ const color = `var(${0 /* TypeHierarchyDirection.Children */ === direction ? '--theia-errorForeground' : '--theia-successBackground'})`;
156
+ return {
157
+ captionSuffixes,
158
+ captionPrefixes: [{
159
+ data,
160
+ fontData: {
161
+ color,
162
+ style: 'bold'
163
+ }
164
+ }]
165
+ };
166
+ }
167
+ })(Node = TypeHierarchyTree.Node || (TypeHierarchyTree.Node = {}));
168
+ })(TypeHierarchyTree || (exports.TypeHierarchyTree = TypeHierarchyTree = {}));
169
+ //# sourceMappingURL=typehierarchy-tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typehierarchy-tree.js","sourceRoot":"","sources":["../../../src/browser/tree/typehierarchy-tree.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;;AAEhF,uDAAuD;AAEvD,4DAA0D;AAC1D,sDAA2D;AAC3D,oDAA6C;AAC7C,6DAA4D;AAE5D,uDAA6H;AAItH,IAAM,iBAAiB,yBAAvB,MAAM,iBAAkB,SAAQ,eAAQ;IAIlC,KAAK,CAAC,eAAe,CAAC,MAAyB;QACpD,IAAI,mBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAClC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC/B,OAAQ,MAAc,CAAC,QAAQ,CAAC;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CAAC,GAAG,CAAC,CAAC,WAAW;oBACnC,QAAQ,EAAE;wBACN,KAAK,EAAE,oCAAoC;qBAC9C;iBACJ,CAAC,CAAC;YACH,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBACd,eAAe,CAAC,OAAO,CAAC;oBACpB,IAAI,EAAE,IAAI,CAAC,MAAM;oBACjB,QAAQ,EAAE;wBACN,KAAK,EAAE,uCAAuC;wBAC9C,KAAK,EAAE,QAAQ;qBAClB;iBACJ,CAAC,CAAC;YACP,CAAC;YACD,MAAM,IAAI,GAAG,GAAG,4CAAoC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;YAC5E,MAAM,KAAK,GAAG,OAAO,4CAAoC,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,2BAA2B,GAAG,CAAC;YAChI,OAAO;gBACH,eAAe;gBACf,eAAe,EAAE,CAAC;wBACd,IAAI;wBACJ,QAAQ,EAAE;4BACN,KAAK;4BACL,KAAK,EAAE,MAAM;yBAChB;qBACJ,CAAC;aACL,CAAC;QACN,CAAC;IAEL,CAAC,EApEgB,IAAI,GAAJ,sBAAI,KAAJ,sBAAI,QAoEpB;AAEL,CAAC,EA1GgB,iBAAiB,iCAAjB,iBAAiB,QA0GjC"}
@@ -0,0 +1,50 @@
1
+ import { MenuModelRegistry } from '@theia/core/lib/common/menu';
2
+ import { ApplicationShell } from '@theia/core/lib/browser/shell';
3
+ import { KeybindingRegistry } from '@theia/core/lib/browser/keybinding';
4
+ import { Command, CommandRegistry } from '@theia/core/lib/common/command';
5
+ import { EditorAccess, EditorManager } from '@theia/editor/lib/browser/editor-manager';
6
+ import { AbstractViewContribution, OpenViewArguments } from '@theia/core/lib/browser/shell/view-contribution';
7
+ import { TypeHierarchyTreeWidget } from './tree/typehierarchy-tree-widget';
8
+ import { TypeHierarchyDirection } from './typehierarchy-provider';
9
+ import { TypeHierarchyServiceProvider } from './typehierarchy-service';
10
+ import { ContextKey, ContextKeyService } from '@theia/core/lib/browser/context-key-service';
11
+ export declare class TypeHierarchyContribution extends AbstractViewContribution<TypeHierarchyTreeWidget> {
12
+ protected readonly shell: ApplicationShell;
13
+ protected readonly editorAccess: EditorAccess;
14
+ protected readonly editorManager: EditorManager;
15
+ protected readonly contextKeyService: ContextKeyService;
16
+ protected editorHasTypeHierarchyProvider: ContextKey<boolean>;
17
+ protected readonly typeHierarchyServiceProvider: TypeHierarchyServiceProvider;
18
+ constructor();
19
+ protected init(): void;
20
+ protected isTypeHierarchyAvailable(): boolean;
21
+ openView(args?: Partial<TypeHierarchyOpenViewArguments>): Promise<TypeHierarchyTreeWidget>;
22
+ registerCommands(commands: CommandRegistry): void;
23
+ registerMenus(menus: MenuModelRegistry): void;
24
+ registerKeybindings(keybindings: KeybindingRegistry): void;
25
+ /**
26
+ * Flips the hierarchy direction in the `Type Hierarchy` view, if it is active and has a valid root.
27
+ * Otherwise, calculates the type hierarchy based on the selection of the current editor.
28
+ */
29
+ protected openViewOrFlipHierarchyDirection(direction: TypeHierarchyDirection): Promise<void>;
30
+ /**
31
+ * Enabled if the `current` editor has the `languageId` or the `Type Hierarchy` widget is the active one.
32
+ */
33
+ protected isEnabled(languageId?: string | undefined): boolean;
34
+ /**
35
+ * Extracts the type hierarchy direction from the argument. If the direction cannot be extracted, returns with the `Children` as the default type.
36
+ */
37
+ protected getDirection(args?: Partial<TypeHierarchyOpenViewArguments>): TypeHierarchyDirection;
38
+ }
39
+ export interface TypeHierarchyOpenViewArguments extends OpenViewArguments {
40
+ /**
41
+ * The type hierarchy direction for the view argument.
42
+ */
43
+ readonly direction: TypeHierarchyDirection;
44
+ }
45
+ export declare namespace TypeHierarchyCommands {
46
+ const TOGGLE_VIEW: Command;
47
+ const OPEN_SUBTYPE: Command;
48
+ const OPEN_SUPERTYPE: Command;
49
+ }
50
+ //# sourceMappingURL=typehierarchy-contribution.d.ts.map