2
2
// Licensed under the MIT license.
3
3
4
4
import { ProviderResult , TreeItem , TreeItemCollapsibleState } from "vscode" ;
5
- import { HierachicalPackageNodeData } from "../java/hierachicalPackageNodeData " ;
5
+ import { HierarchicalPackageNodeData } from "../java/hierarchicalPackageNodeData " ;
6
6
import { INodeData , NodeKind } from "../java/nodeData" ;
7
7
import { Telemetry } from "../telemetry" ;
8
8
import { DataNode } from "./dataNode" ;
@@ -12,7 +12,7 @@ import { PackageNode } from "./packageNode";
12
12
import { ProjectNode } from "./projectNode" ;
13
13
import { TypeRootNode } from "./typeRootNode" ;
14
14
15
- export class HierachicalPackageNode extends PackageNode {
15
+ export class HierarchicalPackageNode extends PackageNode {
16
16
17
17
constructor ( nodeData : INodeData , parent : DataNode , protected _project : ProjectNode , protected _rootNode : DataNode ) {
18
18
super ( nodeData , parent , _project , _rootNode ) ;
@@ -33,25 +33,24 @@ export class HierachicalPackageNode extends PackageNode {
33
33
if ( ! res ) {
34
34
Telemetry . sendEvent ( "load data get undefined result" , { node_kind : this . nodeData . kind . toString ( ) } ) ;
35
35
} else {
36
- // Combine hierachical children and normal packagenode children
36
+ // Combine hierarchical children and normal package node children
37
37
res . forEach ( ( node ) => this . nodeData . children . push ( node ) ) ;
38
38
}
39
39
return this . createChildNodeList ( ) ;
40
40
} ) ;
41
41
}
42
42
43
43
public async revealPaths ( paths : INodeData [ ] ) : Promise < DataNode > {
44
- const hierachicalNodeData = paths [ 0 ] ;
45
- if ( hierachicalNodeData . name === this . nodeData . name ) {
44
+ const hierarchicalNodeData = paths [ 0 ] ;
45
+ if ( hierarchicalNodeData . name === this . nodeData . name ) {
46
46
paths . shift ( ) ;
47
47
// reveal as a package node
48
48
return super . revealPaths ( paths ) ;
49
49
} else {
50
- // reveal as a package root node
51
- const childs : ExplorerNode [ ] = await this . getChildren ( ) ;
52
- const childNode = < DataNode > childs . find ( ( child : DataNode ) =>
53
- child instanceof HierachicalPackageNode && hierachicalNodeData . name . startsWith ( child . nodeData . name ) ) ;
54
- return childNode === null ? null : childNode . revealPaths ( paths ) ;
50
+ const children : ExplorerNode [ ] = await this . getChildren ( ) ;
51
+ const childNode = < DataNode > children . find ( ( child : DataNode ) =>
52
+ hierarchicalNodeData . name . startsWith ( child . nodeData . name + "." ) || hierarchicalNodeData . name === child . nodeData . name ) ;
53
+ return childNode ? childNode . revealPaths ( paths ) : null ;
55
54
}
56
55
}
57
56
@@ -67,8 +66,8 @@ export class HierachicalPackageNode extends PackageNode {
67
66
this . nodeData . children . forEach ( ( nodeData ) => {
68
67
if ( nodeData . kind === NodeKind . File ) {
69
68
result . push ( new FileNode ( nodeData , this ) ) ;
70
- } else if ( nodeData instanceof HierachicalPackageNodeData ) {
71
- result . push ( new HierachicalPackageNode ( nodeData , this , this . _project , this . _rootNode ) ) ;
69
+ } else if ( nodeData instanceof HierarchicalPackageNodeData ) {
70
+ result . push ( new HierarchicalPackageNode ( nodeData , this , this . _project , this . _rootNode ) ) ;
72
71
} else {
73
72
result . push ( new TypeRootNode ( nodeData , this ) ) ;
74
73
}
@@ -77,7 +76,7 @@ export class HierachicalPackageNode extends PackageNode {
77
76
return result ;
78
77
}
79
78
80
- private getHierarchicalNodeData ( ) : HierachicalPackageNodeData {
81
- return < HierachicalPackageNodeData > this . nodeData ;
79
+ private getHierarchicalNodeData ( ) : HierarchicalPackageNodeData {
80
+ return < HierarchicalPackageNodeData > this . nodeData ;
82
81
}
83
82
}
0 commit comments