Skip to content

Commit 44567a1

Browse files
authored
editors - reuse editor config to prevent a second lookup (microsoft#199262)
1 parent 3de501a commit 44567a1

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

src/vs/workbench/browser/parts/editor/textDiffEditor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ export class TextDiffEditor extends AbstractTextEditor<IDiffEditorViewState> imp
267267
return editorConfiguration;
268268
}
269269

270-
protected override getConfigurationOverrides(): IDiffEditorOptions {
270+
protected override getConfigurationOverrides(configuration: IEditorConfiguration): IDiffEditorOptions {
271271
return {
272-
...super.getConfigurationOverrides(),
272+
...super.getConfigurationOverrides(configuration),
273273
...this.getReadonlyConfiguration(this.input?.isReadonly()),
274274
originalEditable: this.input instanceof DiffEditorInput && !this.input.original.isReadonly(),
275275
lineDecorationsWidth: '2ch'

src/vs/workbench/browser/parts/editor/textEditor.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ export interface IEditorConfiguration {
3838
diffEditor?: boolean;
3939
};
4040
};
41+
problems?: {
42+
visibility?: boolean;
43+
};
4144
}
4245

4346
/**
@@ -116,7 +119,7 @@ export abstract class AbstractTextEditor<T extends IEditorViewState> extends Abs
116119

117120
// Specific editor options always overwrite user configuration
118121
const editorConfiguration: ICodeEditorOptions = isObject(configuration.editor) ? deepClone(configuration.editor) : Object.create(null);
119-
Object.assign(editorConfiguration, this.getConfigurationOverrides());
122+
Object.assign(editorConfiguration, this.getConfigurationOverrides(configuration));
120123

121124
// ARIA label
122125
editorConfiguration.ariaLabel = this.computeAriaLabel();
@@ -155,14 +158,13 @@ export abstract class AbstractTextEditor<T extends IEditorViewState> extends Abs
155158
};
156159
}
157160

158-
protected getConfigurationOverrides(): ICodeEditorOptions {
159-
const config = this.textResourceConfigurationService.getValue(this.getActiveResource(), 'problems.visibility');
161+
protected getConfigurationOverrides(configuration: IEditorConfiguration): ICodeEditorOptions {
160162
return {
161163
overviewRulerLanes: 3,
162164
lineNumbersMinChars: 3,
163165
fixedOverflowWidgets: true,
164166
...this.getReadonlyConfiguration(this.input?.isReadonly()),
165-
renderValidationDecorations: config ? 'on' : 'off'
167+
renderValidationDecorations: configuration.problems?.visibility !== false ? 'on' : 'off'
166168
};
167169
}
168170

src/vs/workbench/contrib/output/browser/logViewer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
1414
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
1515
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
1616
import { IFileService } from 'vs/platform/files/common/files';
17+
import { IEditorConfiguration } from 'vs/workbench/browser/parts/editor/textEditor';
1718

1819
export class LogViewer extends AbstractTextResourceEditor {
1920

@@ -32,8 +33,8 @@ export class LogViewer extends AbstractTextResourceEditor {
3233
super(LogViewer.LOG_VIEWER_EDITOR_ID, telemetryService, instantiationService, storageService, textResourceConfigurationService, themeService, editorGroupService, editorService, fileService);
3334
}
3435

35-
protected override getConfigurationOverrides(): IEditorOptions {
36-
const options = super.getConfigurationOverrides();
36+
protected override getConfigurationOverrides(configuration: IEditorConfiguration): IEditorOptions {
37+
const options = super.getConfigurationOverrides(configuration);
3738
options.wordWrap = 'off'; // all log viewers do not wrap
3839
options.folding = false;
3940
options.scrollBeyondLastLine = false;

src/vs/workbench/contrib/output/browser/outputView.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async
3434
import { IFileService } from 'vs/platform/files/common/files';
3535
import { ResourceContextKey } from 'vs/workbench/common/contextkeys';
3636
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
37+
import { IEditorConfiguration } from 'vs/workbench/browser/parts/editor/textEditor';
3738

3839
export class OutputViewPane extends ViewPane {
3940

@@ -177,8 +178,8 @@ class OutputEditor extends AbstractTextResourceEditor {
177178
return nls.localize('output', "Output");
178179
}
179180

180-
protected override getConfigurationOverrides(): ICodeEditorOptions {
181-
const options = super.getConfigurationOverrides();
181+
protected override getConfigurationOverrides(configuration: IEditorConfiguration): ICodeEditorOptions {
182+
const options = super.getConfigurationOverrides(configuration);
182183
options.wordWrap = 'on'; // all output editors wrap
183184
options.lineNumbers = 'off'; // all output editors hide line numbers
184185
options.glyphMargin = false;

0 commit comments

Comments
 (0)