@@ -72,12 +72,13 @@ export class ProjectInformation {
7272 return this . docInfos . get ( docUri ) ?. getFoldingRanges ( ) ?? [ ] ;
7373 }
7474
75- async getDocumentSymbols ( docUri : string ) {
75+ async getDocumentSymbols ( docUri : string ) : Promise < SymbolInformation [ ] > {
7676 const docInfo = this . docInfos . get ( docUri ) ;
7777 if ( docInfo ) {
7878 while ( docInfo . isBusy ) {
7979 await sleep ( 50 ) ;
8080 }
81+ return docInfo ! . getSymbols ( docUri ) ;
8182 }
8283 return [ ] ;
8384 }
@@ -166,6 +167,7 @@ export class DocumentInformation implements ResultsContainer {
166167 }
167168
168169 addElement ( emt : SyntaxElement ) {
170+ // Find the parent element.
169171 while ( this . ancestors ) {
170172 const pnt = this . ancestors . pop ( ) ! ;
171173 if ( emt . isChildOf ( pnt ) ) {
@@ -177,10 +179,12 @@ export class DocumentInformation implements ResultsContainer {
177179 break ;
178180 }
179181 }
182+
183+ // Add the element.
180184 this . elements . push ( emt ) ;
181185 this . ancestors . push ( emt ) ;
182- const x = 3 ;
183186
187+ // Also add identifier elements
184188 if ( emt . identifier ) {
185189 this . addElement ( emt . identifier ) ;
186190 emt . fqName = `${ ( emt . fqName ?? '' ) } .${ emt . identifier . text } ` ;
@@ -280,8 +284,8 @@ export class DocumentInformation implements ResultsContainer {
280284
281285 const semanticTokens = sortSemanticTokens (
282286 this . getElementsInRange ( r )
283- . filter ( ( e ) => ! ! e . semanticToken )
284- . map ( ( e ) => e . semanticToken ! ) ) ;
287+ . filter ( ( e ) => ! ! e . identifier ?. semanticToken )
288+ . map ( ( e ) => e . identifier ! . semanticToken ! ) ) ;
285289
286290 if ( semanticTokens . length === 0 )
287291 return null ;
0 commit comments