@@ -11,7 +11,7 @@ import { basename } from 'vs/base/common/resources';
1111import { Action } from 'vs/base/common/actions' ;
1212import { VIEWLET_ID , TEXT_FILE_EDITOR_ID , IExplorerService } from 'vs/workbench/contrib/files/common/files' ;
1313import { ITextFileService , TextFileOperationError , TextFileOperationResult } from 'vs/workbench/services/textfile/common/textfiles' ;
14- import { BaseTextEditor , IEditorConfiguration } from 'vs/workbench/browser/parts/editor/textEditor' ;
14+ import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor' ;
1515import { EditorOptions , TextEditorOptions , IEditorCloseEvent } from 'vs/workbench/common/editor' ;
1616import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel' ;
1717import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput' ;
@@ -31,7 +31,6 @@ import { IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor';
3131import { createErrorWithActions } from 'vs/base/common/errorsWithActions' ;
3232import { MutableDisposable } from 'vs/base/common/lifecycle' ;
3333import { EditorActivation , IEditorOptions } from 'vs/platform/editor/common/editor' ;
34- import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
3534import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity' ;
3635
3736/**
@@ -41,7 +40,6 @@ export class TextFileEditor extends BaseTextEditor {
4140
4241 static readonly ID = TEXT_FILE_EDITOR_ID ;
4342
44- private restoreViewState : boolean | undefined ;
4543 private readonly groupListener = this . _register ( new MutableDisposable ( ) ) ;
4644
4745 constructor (
@@ -57,13 +55,10 @@ export class TextFileEditor extends BaseTextEditor {
5755 @IEditorGroupsService editorGroupService : IEditorGroupsService ,
5856 @ITextFileService private readonly textFileService : ITextFileService ,
5957 @IExplorerService private readonly explorerService : IExplorerService ,
60- @IConfigurationService private readonly configurationService : IConfigurationService ,
6158 @IUriIdentityService private readonly uriIdentityService : IUriIdentityService
6259 ) {
6360 super ( TextFileEditor . ID , telemetryService , instantiationService , storageService , textResourceConfigurationService , themeService , editorService , editorGroupService ) ;
6461
65- this . updateRestoreViewStateConfiguration ( ) ;
66-
6762 // Clear view state for deleted files
6863 this . _register ( this . fileService . onDidFilesChange ( e => this . onDidFilesChange ( e ) ) ) ;
6964
@@ -84,16 +79,6 @@ export class TextFileEditor extends BaseTextEditor {
8479 }
8580 }
8681
87- protected handleConfigurationChangeEvent ( configuration ?: IEditorConfiguration ) : void {
88- super . handleConfigurationChangeEvent ( configuration ) ;
89-
90- this . updateRestoreViewStateConfiguration ( ) ;
91- }
92-
93- private updateRestoreViewStateConfiguration ( ) : void {
94- this . restoreViewState = this . configurationService . getValue ( 'workbench.editor.restoreViewState' ) ?? true /* default */ ;
95- }
96-
9782 getTitle ( ) : string {
9883 return this . input ? this . input . getName ( ) : nls . localize ( 'textFileEditor' , "Text File Editor" ) ;
9984 }
@@ -121,7 +106,7 @@ export class TextFileEditor extends BaseTextEditor {
121106 // If the editor is not active, we can only clear the view state because it needs
122107 // an active editor with the file opened, so we check for the restoreViewState flag
123108 // being set.
124- if ( editor === this . input || ! this . restoreViewState ) {
109+ if ( editor === this . input || ! this . shouldRestoreViewState ) {
125110 this . doSaveOrClearTextEditorViewState ( editor ) ;
126111 }
127112 }
@@ -277,7 +262,7 @@ export class TextFileEditor extends BaseTextEditor {
277262
278263 // If the user configured to not restore view state, we clear the view
279264 // state unless the editor is still opened in the group.
280- if ( ! this . restoreViewState && ( ! this . group || ! this . group . isOpened ( input ) ) ) {
265+ if ( ! this . shouldRestoreViewState && ( ! this . group || ! this . group . isOpened ( input ) ) ) {
281266 this . clearTextEditorViewState ( [ input . resource ] , this . group ) ;
282267 }
283268
0 commit comments