@@ -1537,20 +1537,16 @@ export class DefaultClient implements Client {
15371537 }
15381538
15391539 public onDidChangeTextDocument ( textDocumentChangeEvent : vscode . TextDocumentChangeEvent ) : void {
1540- if ( textDocumentChangeEvent . document . uri . scheme === "file" ) {
1541- if ( textDocumentChangeEvent . document . languageId === "c"
1542- || textDocumentChangeEvent . document . languageId === "cpp"
1543- || textDocumentChangeEvent . document . languageId === "cuda-cpp" ) {
1544- // If any file has changed, we need to abort the current rename operation
1545- if ( DefaultClient . renamePending ) {
1546- this . cancelReferences ( ) ;
1547- }
1540+ if ( textDocumentChangeEvent . document . uri . scheme === "file" && util . isCppToolsFile ( textDocumentChangeEvent . document ) ) {
1541+ // If any file has changed, we need to abort the current rename operation
1542+ if ( DefaultClient . renamePending ) {
1543+ this . cancelReferences ( ) ;
1544+ }
15481545
1549- const oldVersion : number | undefined = openFileVersions . get ( textDocumentChangeEvent . document . uri . toString ( ) ) ;
1550- const newVersion : number = textDocumentChangeEvent . document . version ;
1551- if ( oldVersion === undefined || newVersion > oldVersion ) {
1552- openFileVersions . set ( textDocumentChangeEvent . document . uri . toString ( ) , newVersion ) ;
1553- }
1546+ const oldVersion : number | undefined = openFileVersions . get ( textDocumentChangeEvent . document . uri . toString ( ) ) ;
1547+ const newVersion : number = textDocumentChangeEvent . document . version ;
1548+ if ( oldVersion === undefined || newVersion > oldVersion ) {
1549+ openFileVersions . set ( textDocumentChangeEvent . document . uri . toString ( ) , newVersion ) ;
15541550 }
15551551 }
15561552 }
@@ -2533,10 +2529,7 @@ export class DefaultClient implements Client {
25332529
25342530 private updateActiveDocumentTextOptions ( ) : void {
25352531 const editor : vscode . TextEditor | undefined = vscode . window . activeTextEditor ;
2536- if ( editor ?. document ?. uri . scheme === "file"
2537- && ( editor . document . languageId === "c"
2538- || editor . document . languageId === "cpp"
2539- || editor . document . languageId === "cuda-cpp" ) ) {
2532+ if ( editor ?. document ?. uri . scheme === "file" && util . isCppToolsFile ( editor . document ) ) {
25402533 vscode . commands . executeCommand ( 'setContext' , 'BuildAndDebug.isSourceFile' , util . isCppOrCFile ( editor . document . uri ) ) ;
25412534 vscode . commands . executeCommand ( 'setContext' , 'BuildAndDebug.isFolderOpen' , util . isFolderOpen ( editor . document . uri ) ) ;
25422535 // If using vcFormat, check for a ".editorconfig" file, and apply those text options to the active document.
@@ -3050,15 +3043,7 @@ export class DefaultClient implements Client {
30503043
30513044 public async handleGenerateDoxygenComment ( args : DoxygenCodeActionCommandArguments | vscode . Uri | undefined ) : Promise < void > {
30523045 const editor : vscode . TextEditor | undefined = vscode . window . activeTextEditor ;
3053- if ( ! editor ) {
3054- return ;
3055- }
3056-
3057- if ( editor . document . uri . scheme !== "file" ) {
3058- return ;
3059- }
3060-
3061- if ( ! ( editor . document . languageId === "c" || editor . document . languageId === "cpp" || editor . document . languageId === "cuda-cpp" ) ) {
3046+ if ( editor ?. document . uri . scheme !== "file" || ! util . isCppToolsFile ( editor . document ) ) {
30623047 return ;
30633048 }
30643049
0 commit comments