import { Workspaces } from "pkgforce" ; export class SymbolFinderError extends Error { constructor ( message ) { super ( message ) ; this . message = message ; this . name = "SymbolFinderError" ; } } export class SymbolFinder { findSymbol ( wsPath , symbol ) { const ws = Workspaces . get ( wsPath ) ; const paths = ( ws . findType ( symbol ) as unknown ) as string [ ] ; if ( paths . length == 0 ) { const parts = symbol . split ( '.' ) ; if ( parts . length > 1 ) { parts . pop ( ) ; return this . findSymbol ( wsPath , parts . join ( '.' ) ) ; } else { return null ; } } return paths [ 0 ] ; } }