File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -124,6 +124,7 @@ export class Parser extends BaseParser {
124124 this . rootDocument = new DtcBaseNode ( ) ;
125125 this . _issues = [ ] ;
126126 this . unhandledStatements = new DtcRootNode ( ) ;
127+ this . #latestSemanticTokensBuilt = false ;
127128 }
128129
129130 public async reparse ( ) : Promise < void > {
@@ -2293,6 +2294,11 @@ export class Parser extends BaseParser {
22932294 ] ;
22942295 }
22952296
2297+ #latestSemanticTokensBuilt = false ;
2298+ get latestSemanticTokensBuilt ( ) {
2299+ return this . #latestSemanticTokensBuilt;
2300+ }
2301+
22962302 buildSemanticTokens ( tokensBuilder : SemanticTokensBuilder , uri : string ) {
22972303 const result : {
22982304 line : number ;
@@ -2309,5 +2315,6 @@ export class Parser extends BaseParser {
23092315 } ) ;
23102316
23112317 super . buildSemanticTokens ( tokensBuilder , uri , result ) ;
2318+ this . #latestSemanticTokensBuilt = true ;
23122319 }
23132320}
Original file line number Diff line number Diff line change @@ -812,6 +812,20 @@ const onChange = async (uri: string) => {
812812
813813 hasWorkspaceDiagnostics . set ( context , true ) ;
814814 } ) ;
815+
816+ if ( activeFileUri ) {
817+ const activeUriParser =
818+ context . getUriParser ( activeFileUri ) ;
819+ if ( activeUriParser ) {
820+ setTimeout ( ( ) => {
821+ if (
822+ ! activeUriParser . latestSemanticTokensBuilt
823+ ) {
824+ connection . languages . semanticTokens . refresh ( ) ;
825+ }
826+ } , 50 ) ;
827+ }
828+ }
815829 }
816830
817831 const [ meta , fileTree ] = await Promise . all ( [
You can’t perform that action at this time.
0 commit comments