import type * as lspTypes from "vscode-languageserver-protocol" ; import { wrapCommand } from "../novaUtils" ; import { createSymbolSearchResultsTree } from "../searchResults" ; export function registerFindSymbol ( client ) { let query = null ; return nova . commands . register ( "apexskier.typescript.findSymbol" , wrapCommand ( findSymbol ) ) ; async function findSymbol ( workspace ) { query = await new Promise < string | null > ( ( resolve ) => { const options = query != null ? { placeholder : query } : { } ; workspace . showInputPalette ( "Search for a symbol name" , options , resolve ) ; } ) ; if ( ! query ) { return ; } const params = { query , } ; const response = ( await client . sendRequest ( "workspace/symbol" , params ) ) as lspTypes . SymbolInformation [ ] | null ; if ( response == null || ! response . length ) { workspace . showWarningMessage ( "Couldn't find symbol." ) ; return ; } createSymbolSearchResultsTree ( response ) ; } }