import { DocumentSymbol , Range , TreeItem , TreeItemCollapsibleState } from "vscode" ; import { BaseSymbolNode } from "./baseSymbolNode" ; import { ExplorerNode } from "./explorerNode" ; import { PrimaryTypeNode } from "./PrimaryTypeNode" ; export class DocumentSymbolNode extends BaseSymbolNode { constructor ( symbolInfo , parent ) { super ( symbolInfo , parent ) ; } public getChildren ( ) { const res = [ ] ; if ( this . symbolInfo && ( < DocumentSymbol > this . symbolInfo ) . children && ( < DocumentSymbol > this . symbolInfo ) . children . length ) { ( < DocumentSymbol > this . symbolInfo ) . children . forEach ( ( child ) => { res . push ( new DocumentSymbolNode ( child , this . getParent ( ) as PrimaryTypeNode ) ) ; } ) ; } return res ; } public getTreeItem ( ) { const item = new TreeItem ( this . symbolInfo . name , ( ( < DocumentSymbol > this . symbolInfo ) . children && ( < DocumentSymbol > this . symbolInfo ) . children . length ) ? TreeItemCollapsibleState . Collapsed : TreeItemCollapsibleState . None ) ; item . iconPath = this . iconPath ; item . command = this . command ; return item ; } protected get range ( ) : Range { return ( < DocumentSymbol > this . symbolInfo ) . selectionRange ; } }