mirror of
https://github.com/Microsoft/vscode
synced 2024-11-05 18:29:38 +00:00
editor options - more 💄 before merge
This commit is contained in:
parent
19c88bc3c7
commit
b82b90c100
9 changed files with 41 additions and 43 deletions
|
@ -28,7 +28,7 @@ import { URI } from 'vs/base/common/uri';
|
|||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { EditorActivation, IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { EditorActivation, ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { isEqual } from 'vs/base/common/resources';
|
||||
import { multibyteAwareBtoa } from 'vs/base/browser/dom';
|
||||
|
@ -107,7 +107,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan
|
|||
return this.instantiationService.createInstance(DiffEditorWidget, parent, configuration, {});
|
||||
}
|
||||
|
||||
override async setInput(input: DiffEditorInput, options: IEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
override async setInput(input: DiffEditorInput, options: ITextEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
|
||||
// Dispose previous diff navigator
|
||||
this.diffNavigatorDisposables.clear();
|
||||
|
@ -190,7 +190,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan
|
|||
return false;
|
||||
}
|
||||
|
||||
private openAsBinary(input: DiffEditorInput, options: IEditorOptions | undefined): void {
|
||||
private openAsBinary(input: DiffEditorInput, options: ITextEditorOptions | undefined): void {
|
||||
const originalInput = input.originalInput;
|
||||
const modifiedInput = input.modifiedInput;
|
||||
|
||||
|
@ -206,19 +206,21 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan
|
|||
modifiedInput.setForceOpenAsBinary();
|
||||
}
|
||||
|
||||
// Make sure to not steal away the currently active group
|
||||
// because we are triggering another openEditor() call
|
||||
// and do not control the initial intent that resulted
|
||||
// in us now opening as binary.
|
||||
options = {
|
||||
...options,
|
||||
activation: EditorActivation.PRESERVE,
|
||||
pinned: this.group?.isPinned(input),
|
||||
sticky: this.group?.isSticky(input)
|
||||
};
|
||||
|
||||
// Replace this editor with the binary one
|
||||
this.editorService.replaceEditors([{ editor: input, replacement: binaryDiffInput, options }], this.group || ACTIVE_GROUP);
|
||||
this.editorService.replaceEditors([{
|
||||
editor: input,
|
||||
replacement: binaryDiffInput,
|
||||
options: {
|
||||
...options,
|
||||
// Make sure to not steal away the currently active group
|
||||
// because we are triggering another openEditor() call
|
||||
// and do not control the initial intent that resulted
|
||||
// in us now opening as binary.
|
||||
activation: EditorActivation.PRESERVE,
|
||||
pinned: this.group?.isPinned(input),
|
||||
sticky: this.group?.isSticky(input)
|
||||
}
|
||||
}], this.group || ACTIVE_GROUP);
|
||||
}
|
||||
|
||||
protected override computeConfiguration(configuration: IEditorConfiguration): ICodeEditorOptions {
|
||||
|
|
|
@ -29,7 +29,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
|
|||
import { IExtUri } from 'vs/base/common/resources';
|
||||
import { MutableDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
export interface IEditorConfiguration {
|
||||
editor: object;
|
||||
|
@ -156,7 +156,7 @@ export abstract class BaseTextEditor extends EditorPane implements ITextEditorPa
|
|||
return this.instantiationService.createInstance(CodeEditorWidget, parent, configuration, {});
|
||||
}
|
||||
|
||||
override async setInput(input: EditorInput, options: IEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
override async setInput(input: EditorInput, options: ITextEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
await super.setInput(input, options, context, token);
|
||||
|
||||
// Update editor options after having set the input. We do this because there can be
|
||||
|
@ -168,7 +168,7 @@ export abstract class BaseTextEditor extends EditorPane implements ITextEditorPa
|
|||
editorContainer.setAttribute('aria-label', this.computeAriaLabel());
|
||||
}
|
||||
|
||||
override setOptions(options: IEditorOptions | undefined): void {
|
||||
override setOptions(options: ITextEditorOptions | undefined): void {
|
||||
if (options) {
|
||||
applyTextEditorOptions(options, assertIsDefined(this.getControl()), ScrollType.Smooth);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import { IModeService } from 'vs/editor/common/services/modeService';
|
|||
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
|
||||
import { EditorOption, IEditorOptions as ICodeEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { ModelConstants } from 'vs/editor/common/model';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
/**
|
||||
* An editor implementation that is capable of showing the contents of resource inputs. Uses
|
||||
|
@ -56,7 +56,7 @@ export class AbstractTextResourceEditor extends BaseTextEditor {
|
|||
return localize('textEditor', "Text Editor");
|
||||
}
|
||||
|
||||
override async setInput(input: AbstractTextResourceEditorInput, options: IEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
override async setInput(input: AbstractTextResourceEditorInput, options: ITextEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
|
||||
// Remember view settings if input changes
|
||||
this.saveTextResourceEditorViewState(this.input);
|
||||
|
|
|
@ -29,7 +29,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
|
|||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { createErrorWithActions } from 'vs/base/common/errors';
|
||||
import { EditorActivation, EditorOverride, IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { EditorActivation, EditorOverride, ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
|
||||
import { IExplorerService } from 'vs/workbench/contrib/files/browser/files';
|
||||
|
||||
|
@ -105,7 +105,7 @@ export class TextFileEditor extends BaseTextEditor {
|
|||
return this._input as FileEditorInput;
|
||||
}
|
||||
|
||||
override async setInput(input: FileEditorInput, options: IEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
override async setInput(input: FileEditorInput, options: ITextEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
|
||||
// Update/clear view settings if input changes
|
||||
this.doSaveOrClearTextEditorViewState(this.input);
|
||||
|
@ -157,7 +157,7 @@ export class TextFileEditor extends BaseTextEditor {
|
|||
}
|
||||
}
|
||||
|
||||
protected handleSetInputError(error: Error, input: FileEditorInput, options: IEditorOptions | undefined): void {
|
||||
protected handleSetInputError(error: Error, input: FileEditorInput, options: ITextEditorOptions | undefined): void {
|
||||
|
||||
// In case we tried to open a file inside the text editor and the response
|
||||
// indicates that this is not a text file, reopen the file through the binary
|
||||
|
@ -197,20 +197,18 @@ export class TextFileEditor extends BaseTextEditor {
|
|||
throw error;
|
||||
}
|
||||
|
||||
private openAsBinary(input: FileEditorInput, options: IEditorOptions | undefined): void {
|
||||
private openAsBinary(input: FileEditorInput, options: ITextEditorOptions | undefined): void {
|
||||
input.setForceOpenAsBinary();
|
||||
|
||||
// Make sure to not steal away the currently active group
|
||||
// because we are triggering another openEditor() call
|
||||
// and do not control the initial intent that resulted
|
||||
// in us now opening as binary.
|
||||
options = {
|
||||
this.editorService.openEditor(input, {
|
||||
...options,
|
||||
// Make sure to not steal away the currently active group
|
||||
// because we are triggering another openEditor() call
|
||||
// and do not control the initial intent that resulted
|
||||
// in us now opening as binary.
|
||||
activation: EditorActivation.PRESERVE,
|
||||
override: EditorOverride.DISABLED
|
||||
};
|
||||
|
||||
this.editorService.openEditor(input, options, this.group);
|
||||
}, this.group);
|
||||
}
|
||||
|
||||
private async openAsFolder(input: FileEditorInput): Promise<void> {
|
||||
|
|
|
@ -24,7 +24,7 @@ import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
|
|||
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
|
||||
import { IExplorerService } from 'vs/workbench/contrib/files/browser/files';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
/**
|
||||
* An implementation of editor for file system resources.
|
||||
|
@ -52,7 +52,7 @@ export class NativeTextFileEditor extends TextFileEditor {
|
|||
super(telemetryService, fileService, viewletService, instantiationService, contextService, storageService, textResourceConfigurationService, editorService, themeService, editorGroupService, textFileService, explorerService, uriIdentityService);
|
||||
}
|
||||
|
||||
protected override handleSetInputError(error: Error, input: FileEditorInput, options: IEditorOptions | undefined): void {
|
||||
protected override handleSetInputError(error: Error, input: FileEditorInput, options: ITextEditorOptions | undefined): void {
|
||||
|
||||
// Allow to restart with higher memory limit if the file is too large
|
||||
if ((<FileOperationError>error).fileOperationResult === FileOperationResult.FILE_EXCEEDS_MEMORY_LIMIT) {
|
||||
|
|
|
@ -23,7 +23,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
|||
import { IEditorOptions as ICodeEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { BareFontInfo, FontInfo } from 'vs/editor/common/config/fontInfo';
|
||||
import { getPixelRatio, getZoomLevel } from 'vs/base/browser/browser';
|
||||
import { CellEditState, ICellOutputViewModel, IDisplayOutputLayoutUpdateRequest, IGenericCellViewModel, IInsetRenderOutput, NotebookLayoutInfo, NOTEBOOK_DIFF_EDITOR_ID } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { CellEditState, ICellOutputViewModel, IDisplayOutputLayoutUpdateRequest, IGenericCellViewModel, IInsetRenderOutput, INotebookEditorOptions, NotebookLayoutInfo, NOTEBOOK_DIFF_EDITOR_ID } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { DiffSide, DIFF_CELL_MARGIN, IDiffCellInfo, INotebookTextDiffEditor } from 'vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
|
@ -41,7 +41,6 @@ import { BackLayerWebView } from 'vs/workbench/contrib/notebook/browser/view/ren
|
|||
import { NotebookDiffEditorEventDispatcher, NotebookDiffLayoutChangedEvent } from 'vs/workbench/contrib/notebook/browser/diff/eventDispatcher';
|
||||
import { readFontInfo } from 'vs/editor/browser/config/configuration';
|
||||
import { NotebookOptions } from 'vs/workbench/contrib/notebook/common/notebookOptions';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
const $ = DOM.$;
|
||||
|
||||
|
@ -293,7 +292,7 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
|
|||
}
|
||||
}
|
||||
|
||||
override async setInput(input: NotebookDiffEditorInput, options: IEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
override async setInput(input: NotebookDiffEditorInput, options: INotebookEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
await super.setInput(input, options, context, token);
|
||||
|
||||
const model = await input.resolve();
|
||||
|
|
|
@ -11,7 +11,7 @@ import 'vs/css!./media/notebook';
|
|||
import { localize } from 'vs/nls';
|
||||
import { extname } from 'vs/base/common/resources';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { EditorOverride, IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { EditorOverride } from 'vs/platform/editor/common/editor';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
|
@ -152,7 +152,7 @@ export class NotebookEditor extends EditorPane {
|
|||
return !!value && (DOM.isAncestor(activeElement, value.getDomNode() || DOM.isAncestor(activeElement, value.getOverflowContainerDomNode())));
|
||||
}
|
||||
|
||||
override async setInput(input: NotebookEditorInput, options: IEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
override async setInput(input: NotebookEditorInput, options: INotebookEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
clearMarks(input.resource);
|
||||
mark(input.resource, 'startTime');
|
||||
const group = this.group!;
|
||||
|
|
|
@ -37,7 +37,7 @@ import { editorBackground, selectBorder } from 'vs/platform/theme/common/colorRe
|
|||
import { SelectActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
|
||||
import { Dimension } from 'vs/base/browser/dom';
|
||||
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
export class OutputViewPane extends ViewPane {
|
||||
|
||||
|
@ -222,7 +222,7 @@ export class OutputEditor extends AbstractTextResourceEditor {
|
|||
return channel ? nls.localize('outputViewWithInputAriaLabel', "{0}, Output panel", channel.label) : nls.localize('outputViewAriaLabel', "Output panel");
|
||||
}
|
||||
|
||||
override async setInput(input: TextResourceEditorInput, options: IEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
override async setInput(input: TextResourceEditorInput, options: ITextEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
const focus = !(options && options.preserveFocus);
|
||||
if (input.matches(this.input)) {
|
||||
return;
|
||||
|
|
|
@ -28,7 +28,6 @@ import { SelectionHighlighter } from 'vs/editor/contrib/multicursor/multicursor'
|
|||
import * as nls from 'vs/nls';
|
||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { IConstructorSignature1, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
|
||||
|
@ -1023,7 +1022,7 @@ export class DefaultPreferencesEditor extends BaseTextEditor {
|
|||
return options;
|
||||
}
|
||||
|
||||
override async setInput(input: DefaultPreferencesEditorInput, options: IEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
override async setInput(input: DefaultPreferencesEditorInput, options: ISettingsEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
await super.setInput(input, options, context, token);
|
||||
const editorModel = await this.input!.resolve();
|
||||
if (!editorModel) {
|
||||
|
|
Loading…
Reference in a new issue