@@ -1537,20 +1537,16 @@ export class DefaultClient implements Client {
1537
1537
}
1538
1538
1539
1539
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
+ }
1548
1545
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 ) ;
1554
1550
}
1555
1551
}
1556
1552
}
@@ -2533,10 +2529,7 @@ export class DefaultClient implements Client {
2533
2529
2534
2530
private updateActiveDocumentTextOptions ( ) : void {
2535
2531
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 ) ) {
2540
2533
vscode . commands . executeCommand ( 'setContext' , 'BuildAndDebug.isSourceFile' , util . isCppOrCFile ( editor . document . uri ) ) ;
2541
2534
vscode . commands . executeCommand ( 'setContext' , 'BuildAndDebug.isFolderOpen' , util . isFolderOpen ( editor . document . uri ) ) ;
2542
2535
// 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 {
3050
3043
3051
3044
public async handleGenerateDoxygenComment ( args : DoxygenCodeActionCommandArguments | vscode . Uri | undefined ) : Promise < void > {
3052
3045
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 ) ) {
3062
3047
return ;
3063
3048
}
3064
3049
0 commit comments