1
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT license.
3
3
4
- import { Command , SymbolInformation , SymbolKind , TreeItem , TreeItemCollapsibleState } from "vscode" ;
5
- import { Commands } from "../commands" ;
4
+ import { Range , SymbolInformation , TreeItem , TreeItemCollapsibleState } from "vscode" ;
6
5
import { ITypeRootNodeData } from "../java/typeRootNodeData" ;
7
- import { Services } from "../services " ;
6
+ import { BaseSymbolNode } from "./baseSymbolNode " ;
8
7
import { ExplorerNode } from "./explorerNode" ;
9
8
import { TypeRootNode } from "./typeRootNode" ;
10
9
11
- export class SymbolNode extends ExplorerNode {
12
-
13
- private static _iconMap : Map < SymbolKind , string > = new Map ( [
14
- [ SymbolKind . Class , "Class" ] ,
15
- [ SymbolKind . Interface , "Interface" ] ,
16
- [ SymbolKind . Enum , "Enumerator" ] ,
17
- [ SymbolKind . EnumMember , "EnumItem" ] ,
18
- [ SymbolKind . Constant , "Constant" ] ,
19
- [ SymbolKind . Method , "Method" ] ,
20
- [ SymbolKind . Function , "Method" ] ,
21
- [ SymbolKind . Constructor , "Method" ] ,
22
- [ SymbolKind . Field , "Field" ] ,
23
- [ SymbolKind . Property , "Property" ] ,
24
- [ SymbolKind . Variable , "LocalVariable" ] ,
25
- [ SymbolKind . Constant , "Constant" ] ,
26
-
27
- ] ) ;
28
-
10
+ export class SymbolNode extends BaseSymbolNode {
29
11
private _children : SymbolInformation [ ] ;
30
12
31
- constructor ( public readonly symbolInfo : SymbolInformation , private parent : TypeRootNode ) {
32
- super ( parent ) ;
13
+ constructor ( symbolInfo : SymbolInformation , parent : TypeRootNode ) {
14
+ super ( symbolInfo , parent ) ;
33
15
}
34
16
35
17
public getChildren ( ) : ExplorerNode [ ] | Thenable < ExplorerNode [ ] > {
@@ -56,21 +38,7 @@ export class SymbolNode extends ExplorerNode {
56
38
}
57
39
}
58
40
59
- private get iconPath ( ) : any {
60
- if ( SymbolNode . _iconMap . has ( this . symbolInfo . kind ) ) {
61
- const iconFileName = SymbolNode . _iconMap . get ( this . symbolInfo . kind ) ;
62
- return {
63
- light : Services . context . asAbsolutePath ( `./images/symbols/${ iconFileName } _16x.svg` ) ,
64
- dark : Services . context . asAbsolutePath ( `./images/symbols/${ iconFileName } _inverse_16x.svg` ) ,
65
- } ;
66
- }
67
- }
68
-
69
- protected get command ( ) : Command {
70
- return {
71
- title : "Go to outline" ,
72
- command : Commands . VIEW_PACKAGE_OUTLINE ,
73
- arguments : [ ( this . getParent ( ) as TypeRootNode ) . uri , this . symbolInfo . location . range ] ,
74
- } ;
41
+ protected get range ( ) : Range {
42
+ return ( < SymbolInformation > this . symbolInfo ) . location . range ;
75
43
}
76
44
}
0 commit comments