forked from microsoft/vscode-java-dependency
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbaseSymbolNode.ts
More file actions
47 lines (40 loc) · 1.66 KB
/
Copy pathbaseSymbolNode.ts
File metadata and controls
47 lines (40 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
import { Command, DocumentSymbol, Range, SymbolInformation, SymbolKind, ThemeIcon } from "vscode";
import { Commands } from "../commands";
import { ExplorerNode } from "./explorerNode";
import { PrimaryTypeNode } from "./PrimaryTypeNode";
export abstract class BaseSymbolNode extends ExplorerNode {
private static _iconMap: Map<SymbolKind, string> = new Map([
[SymbolKind.Package, "package"],
[SymbolKind.Class, "class"],
[SymbolKind.Interface, "interface"],
[SymbolKind.Enum, "enum"],
[SymbolKind.EnumMember, "enum-member"],
[SymbolKind.Constant, "constant"],
[SymbolKind.Method, "method"],
[SymbolKind.Function, "method"],
[SymbolKind.Constructor, "method"],
[SymbolKind.Field, "field"],
[SymbolKind.Property, "property"],
[SymbolKind.Variable, "variable"],
]);
constructor(public readonly symbolInfo: SymbolInformation | DocumentSymbol, parent: PrimaryTypeNode) {
super(parent);
}
protected get iconPath(): ThemeIcon {
if (BaseSymbolNode._iconMap.has(this.symbolInfo.kind)) {
const symbolKind = BaseSymbolNode._iconMap.get(this.symbolInfo.kind);
return new ThemeIcon(`symbol-${symbolKind}`);
}
return new ThemeIcon("symbol-misc");
}
protected get command(): Command {
return {
title: "Go to outline",
command: Commands.VIEW_PACKAGE_OUTLINE,
arguments: [(this.getParent() as PrimaryTypeNode).uri, this.range],
};
}
protected abstract get range(): Range;
}