@@ -379,8 +379,16 @@ function documentSymbol(msg: p.RequestMessage) {
379379 // https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol
380380 let params = msg . params as p . DocumentSymbolParams ;
381381 let filePath = fileURLToPath ( params . textDocument . uri ) ;
382- let code = getOpenedFileContent ( params . textDocument . uri ) ;
383382 let extension = path . extname ( params . textDocument . uri ) ;
383+ if ( extension !== c . resExt && extension !== c . resiExt ) {
384+ // Can be called on renamed extension after rename
385+ return {
386+ jsonrpc : c . jsonrpcVersion ,
387+ id : msg . id ,
388+ result : null ,
389+ } ;
390+ }
391+ let code = getOpenedFileContent ( params . textDocument . uri ) ;
384392 let tmpname = utils . createFileInTempDir ( extension ) ;
385393 fs . writeFileSync ( tmpname , code , { encoding : "utf-8" } ) ;
386394 let response = utils . runAnalysisCommand (
@@ -397,8 +405,16 @@ function semanticTokens(msg: p.RequestMessage) {
397405 // https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens
398406 let params = msg . params as p . SemanticTokensParams ;
399407 let filePath = fileURLToPath ( params . textDocument . uri ) ;
400- let code = getOpenedFileContent ( params . textDocument . uri ) ;
401408 let extension = path . extname ( params . textDocument . uri ) ;
409+ if ( extension !== c . resExt && extension !== c . resiExt ) {
410+ // Can be called on renamed extension after rename
411+ return {
412+ jsonrpc : c . jsonrpcVersion ,
413+ id : msg . id ,
414+ result : null ,
415+ } ;
416+ }
417+ let code = getOpenedFileContent ( params . textDocument . uri ) ;
402418 let tmpname = utils . createFileInTempDir ( extension ) ;
403419 fs . writeFileSync ( tmpname , code , { encoding : "utf-8" } ) ;
404420 let response = utils . runAnalysisCommand (
0 commit comments