editors - some type 💄 around setInput

This commit is contained in:
Benjamin Pasero 2021-05-21 17:54:05 +02:00
parent 8f093359f0
commit adf68a52d5
No known key found for this signature in database
GPG key ID: E6380CC4C8219E65
3 changed files with 10 additions and 10 deletions

View file

@ -94,11 +94,11 @@ export class SideBySideEditor extends EditorPane {
this.updateStyles();
}
override async setInput(newInput: EditorInput, options: EditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
const oldInput = this.input as SideBySideEditorInput;
await super.setInput(newInput, options, context, token);
override async setInput(input: SideBySideEditorInput, options: EditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
const oldInput = this.input;
await super.setInput(input, options, context, token);
return this.updateInput(oldInput, (newInput as SideBySideEditorInput), options, context, token);
return this.updateInput(oldInput, input, options, context, token);
}
override setOptions(options: EditorOptions | undefined): void {
@ -162,7 +162,7 @@ export class SideBySideEditor extends EditorPane {
return this.secondaryEditorPane;
}
private async updateInput(oldInput: SideBySideEditorInput, newInput: SideBySideEditorInput, options: EditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
private async updateInput(oldInput: EditorInput | undefined, newInput: SideBySideEditorInput, options: EditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
if (!newInput.matches(oldInput)) {
if (oldInput) {
this.disposeEditors();

View file

@ -12,7 +12,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { EditorInput, EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
import { EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
import { AbstractTextResourceEditor } from 'vs/workbench/browser/parts/editor/textResourceEditor';
import { OUTPUT_VIEW_ID, IOutputService, CONTEXT_IN_OUTPUT, IOutputChannel, CONTEXT_ACTIVE_LOG_OUTPUT, CONTEXT_OUTPUT_SCROLL_LOCK } from 'vs/workbench/contrib/output/common/output';
import { IThemeService, registerThemingParticipant, IColorTheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
@ -221,7 +221,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: EditorInput, options: EditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
override async setInput(input: TextResourceEditorInput, options: EditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {//
const focus = !(options && options.preserveFocus);
if (input.matches(this.input)) {
return;

View file

@ -151,14 +151,14 @@ export class PreferencesEditor extends EditorPane {
this.preferencesRenderers.editFocusedPreference();
}
override setInput(newInput: EditorInput, options: SettingsEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
override setInput(input: PreferencesEditorInput, options: SettingsEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {//
this.defaultSettingsEditorContextKey.set(true);
this.defaultSettingsJSONEditorContextKey.set(true);
if (options && options.query) {
this.focusSearch(options.query);
}
return super.setInput(newInput, options, context, token).then(() => this.updateInput(newInput as PreferencesEditorInput, options, context, token));
return super.setInput(input, options, context, token).then(() => this.updateInput(input, options, context, token));
}
layout(dimension: DOM.Dimension): void {
@ -205,7 +205,7 @@ export class PreferencesEditor extends EditorPane {
}
private updateInput(newInput: PreferencesEditorInput, options: EditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
return this.sideBySidePreferencesWidget.setInput(<DefaultPreferencesEditorInput>newInput.secondary, <EditorInput>newInput.primary, options, context, token).then(({ defaultPreferencesRenderer, editablePreferencesRenderer }) => {
return this.sideBySidePreferencesWidget.setInput(<DefaultPreferencesEditorInput>newInput.secondary, newInput.primary, options, context, token).then(({ defaultPreferencesRenderer, editablePreferencesRenderer }) => {
if (token.isCancellationRequested) {
return;
}