mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-26 19:36:52 +01:00
editors - reuse editor config to prevent a second lookup (#199262)
This commit is contained in:
@@ -267,9 +267,9 @@ export class TextDiffEditor extends AbstractTextEditor<IDiffEditorViewState> imp
|
||||
return editorConfiguration;
|
||||
}
|
||||
|
||||
protected override getConfigurationOverrides(): IDiffEditorOptions {
|
||||
protected override getConfigurationOverrides(configuration: IEditorConfiguration): IDiffEditorOptions {
|
||||
return {
|
||||
...super.getConfigurationOverrides(),
|
||||
...super.getConfigurationOverrides(configuration),
|
||||
...this.getReadonlyConfiguration(this.input?.isReadonly()),
|
||||
originalEditable: this.input instanceof DiffEditorInput && !this.input.original.isReadonly(),
|
||||
lineDecorationsWidth: '2ch'
|
||||
|
||||
@@ -38,6 +38,9 @@ export interface IEditorConfiguration {
|
||||
diffEditor?: boolean;
|
||||
};
|
||||
};
|
||||
problems?: {
|
||||
visibility?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +119,7 @@ export abstract class AbstractTextEditor<T extends IEditorViewState> extends Abs
|
||||
|
||||
// Specific editor options always overwrite user configuration
|
||||
const editorConfiguration: ICodeEditorOptions = isObject(configuration.editor) ? deepClone(configuration.editor) : Object.create(null);
|
||||
Object.assign(editorConfiguration, this.getConfigurationOverrides());
|
||||
Object.assign(editorConfiguration, this.getConfigurationOverrides(configuration));
|
||||
|
||||
// ARIA label
|
||||
editorConfiguration.ariaLabel = this.computeAriaLabel();
|
||||
@@ -155,14 +158,13 @@ export abstract class AbstractTextEditor<T extends IEditorViewState> extends Abs
|
||||
};
|
||||
}
|
||||
|
||||
protected getConfigurationOverrides(): ICodeEditorOptions {
|
||||
const config = this.textResourceConfigurationService.getValue(this.getActiveResource(), 'problems.visibility');
|
||||
protected getConfigurationOverrides(configuration: IEditorConfiguration): ICodeEditorOptions {
|
||||
return {
|
||||
overviewRulerLanes: 3,
|
||||
lineNumbersMinChars: 3,
|
||||
fixedOverflowWidgets: true,
|
||||
...this.getReadonlyConfiguration(this.input?.isReadonly()),
|
||||
renderValidationDecorations: config ? 'on' : 'off'
|
||||
renderValidationDecorations: configuration.problems?.visibility !== false ? 'on' : 'off'
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IEditorConfiguration } from 'vs/workbench/browser/parts/editor/textEditor';
|
||||
|
||||
export class LogViewer extends AbstractTextResourceEditor {
|
||||
|
||||
@@ -32,8 +33,8 @@ export class LogViewer extends AbstractTextResourceEditor {
|
||||
super(LogViewer.LOG_VIEWER_EDITOR_ID, telemetryService, instantiationService, storageService, textResourceConfigurationService, themeService, editorGroupService, editorService, fileService);
|
||||
}
|
||||
|
||||
protected override getConfigurationOverrides(): IEditorOptions {
|
||||
const options = super.getConfigurationOverrides();
|
||||
protected override getConfigurationOverrides(configuration: IEditorConfiguration): IEditorOptions {
|
||||
const options = super.getConfigurationOverrides(configuration);
|
||||
options.wordWrap = 'off'; // all log viewers do not wrap
|
||||
options.folding = false;
|
||||
options.scrollBeyondLastLine = false;
|
||||
|
||||
@@ -34,6 +34,7 @@ import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { ResourceContextKey } from 'vs/workbench/common/contextkeys';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { IEditorConfiguration } from 'vs/workbench/browser/parts/editor/textEditor';
|
||||
|
||||
export class OutputViewPane extends ViewPane {
|
||||
|
||||
@@ -177,8 +178,8 @@ class OutputEditor extends AbstractTextResourceEditor {
|
||||
return nls.localize('output', "Output");
|
||||
}
|
||||
|
||||
protected override getConfigurationOverrides(): ICodeEditorOptions {
|
||||
const options = super.getConfigurationOverrides();
|
||||
protected override getConfigurationOverrides(configuration: IEditorConfiguration): ICodeEditorOptions {
|
||||
const options = super.getConfigurationOverrides(configuration);
|
||||
options.wordWrap = 'on'; // all output editors wrap
|
||||
options.lineNumbers = 'off'; // all output editors hide line numbers
|
||||
options.glyphMargin = false;
|
||||
|
||||
Reference in New Issue
Block a user