@@ -55,6 +55,7 @@ import { CustomConfigurationProvider1, getCustomConfigProviders, isSameProviderE
5555import { DataBinding } from './dataBinding' ;
5656import { cachedEditorConfigSettings , getEditorConfigSettings } from './editorConfig' ;
5757import { CppSourceStr , clients , configPrefix , initializeIntervalTimer , isWritingCrashCallStack , updateLanguageConfigurations , usesCrashHandler , watchForCrashes } from './extension' ;
58+ import { IncludeCleanupPreferences , getIncludeCleanupPreferences } from './includeCleanupEditorConfig' ;
5859import { LanguageClient } from './languageClient' ;
5960import { LocalizeStringParams , getLocaleId , getLocalizedString } from './localization' ;
6061import { PersistentFolderState , PersistentState , PersistentWorkspaceState } from './persistentState' ;
@@ -511,6 +512,7 @@ interface TagParseStatus {
511512interface VisibleEditorInfo {
512513 visibleRanges : Range [ ] ;
513514 originalEncoding : string ;
515+ includeCleanupPreferences : IncludeCleanupPreferences ;
514516}
515517
516518interface DidChangeVisibleTextEditorsParams {
@@ -1929,9 +1931,11 @@ export class DefaultClient implements Client {
19291931 // First, we just concat all ranges for the same file.
19301932 const uri : string = editor . document . uri . toString ( ) ;
19311933 if ( ! visibileEditorInfo [ uri ] ) {
1934+ const editorConfigSettings : any = getEditorConfigSettings ( editor . document . uri . fsPath ) ;
19321935 visibileEditorInfo [ uri ] = {
19331936 visibleRanges : [ ] ,
1934- originalEncoding : editor . document . encoding
1937+ originalEncoding : editor . document . encoding ,
1938+ includeCleanupPreferences : getIncludeCleanupPreferences ( editorConfigSettings )
19351939 } ;
19361940 }
19371941 visibileEditorInfo [ uri ] . visibleRanges = visibileEditorInfo [ uri ] . visibleRanges . concat ( editor . visibleRanges . map ( makeLspRange ) ) ;
@@ -2684,6 +2688,15 @@ export class DefaultClient implements Client {
26842688
26852689 private associations_for_did_change ?: Set < string > ;
26862690
2691+ private refreshEditorConfigSettings ( ) : void {
2692+ cachedEditorConfigSettings . clear ( ) ;
2693+ cachedEditorConfigLookups . clear ( ) ;
2694+ this . updateActiveDocumentTextOptions ( ) ;
2695+
2696+ const cppEditors : vscode . TextEditor [ ] = vscode . window . visibleTextEditors . filter ( editor => util . isCpp ( editor . document ) ) ;
2697+ void this . onDidChangeVisibleTextEditors ( cppEditors ) . catch ( logAndReturn . undefined ) ;
2698+ }
2699+
26872700 /**
26882701 * listen for file created/deleted events under the ${workspaceFolder} folder
26892702 */
@@ -2704,9 +2717,7 @@ export class DefaultClient implements Client {
27042717 }
27052718 const fileName : string = path . basename ( uri . fsPath ) . toLowerCase ( ) ;
27062719 if ( fileName === ".editorconfig" ) {
2707- cachedEditorConfigSettings . clear ( ) ;
2708- cachedEditorConfigLookups . clear ( ) ;
2709- this . updateActiveDocumentTextOptions ( ) ;
2720+ this . refreshEditorConfigSettings ( ) ;
27102721 }
27112722 if ( fileName === ".clang-format" || fileName === "_clang-format" ) {
27122723 cachedEditorConfigLookups . clear ( ) ;
@@ -2732,9 +2743,7 @@ export class DefaultClient implements Client {
27322743 const dotIndex : number = uri . fsPath . lastIndexOf ( '.' ) ;
27332744 const fileName : string = path . basename ( uri . fsPath ) . toLowerCase ( ) ;
27342745 if ( fileName === ".editorconfig" ) {
2735- cachedEditorConfigSettings . clear ( ) ;
2736- cachedEditorConfigLookups . clear ( ) ;
2737- this . updateActiveDocumentTextOptions ( ) ;
2746+ this . refreshEditorConfigSettings ( ) ;
27382747 }
27392748 const ext : string | undefined = dotIndex !== - 1 ? uri . fsPath . substring ( dotIndex + 1 ) : undefined ;
27402749 const isTrackedFile : boolean = hasNativeFileTypeMappings ( )
@@ -2759,8 +2768,7 @@ export class DefaultClient implements Client {
27592768 }
27602769 const fileName : string = path . basename ( uri . fsPath ) . toLowerCase ( ) ;
27612770 if ( fileName === ".editorconfig" ) {
2762- cachedEditorConfigSettings . clear ( ) ;
2763- cachedEditorConfigLookups . clear ( ) ;
2771+ this . refreshEditorConfigSettings ( ) ;
27642772 }
27652773 if ( fileName === ".clang-format" || fileName === "_clang-format" ) {
27662774 cachedEditorConfigLookups . clear ( ) ;
0 commit comments