don't make protected inherited properties/method public. this hurts minification.

there is still plenty of cases left: either in tests that make "internals" accessible or in the composite land
pull/166126/head
Johannes 2022-11-14 13:53:07 +01:00
parent 201e6a3e11
commit 5b41a13442
No known key found for this signature in database
GPG Key ID: 6DEF802A22264FCA
32 changed files with 57 additions and 60 deletions

View File

@ -334,13 +334,13 @@ export class ActionViewItem extends BaseActionViewItem {
}
}
override updateLabel(): void {
protected override updateLabel(): void {
if (this.options.label && this.label) {
this.label.textContent = this.action.label;
}
}
override getTooltip() {
protected override getTooltip() {
let title: string | null = null;
if (this.action.tooltip) {
@ -356,7 +356,7 @@ export class ActionViewItem extends BaseActionViewItem {
return title ?? undefined;
}
override updateClass(): void {
protected override updateClass(): void {
if (this.cssClass && this.label) {
this.label.classList.remove(...this.cssClass.split(' '));
}
@ -377,7 +377,7 @@ export class ActionViewItem extends BaseActionViewItem {
}
}
override updateEnabled(): void {
protected override updateEnabled(): void {
if (this.action.enabled) {
if (this.label) {
this.label.removeAttribute('aria-disabled');
@ -395,14 +395,14 @@ export class ActionViewItem extends BaseActionViewItem {
}
}
override updateAriaLabel(): void {
protected override updateAriaLabel(): void {
if (this.label) {
const title = this.getTooltip() ?? '';
this.label.setAttribute('aria-label', title);
}
}
override updateChecked(): void {
protected override updateChecked(): void {
if (this.label) {
if (this.action.checked) {
this.label.classList.add('checked');

View File

@ -131,7 +131,7 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
this.updateEnabled();
}
override getTooltip(): string | undefined {
protected override getTooltip(): string | undefined {
let title: string | null = null;
if (this.action.tooltip) {
@ -233,5 +233,3 @@ export class ActionWithDropdownActionViewItem extends ActionViewItem {
this.dropdownMenuActionViewItem?.setFocusable(focusable);
}
}

View File

@ -564,7 +564,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
}
}
override updateLabel(): void {
protected override updateLabel(): void {
if (!this.label) {
return;
}
@ -615,11 +615,11 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
}
}
override updateTooltip(): void {
protected override updateTooltip(): void {
// menus should function like native menus and they do not have tooltips
}
override updateClass(): void {
protected override updateClass(): void {
if (this.cssClass && this.item) {
this.item.classList.remove(...this.cssClass.split(' '));
}
@ -635,7 +635,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
}
}
override updateEnabled(): void {
protected override updateEnabled(): void {
if (this.action.enabled) {
if (this.element) {
this.element.classList.remove('disabled');
@ -660,7 +660,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
}
}
override updateChecked(): void {
protected override updateChecked(): void {
if (!this.item) {
return;
}
@ -805,7 +805,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem {
}));
}
override updateEnabled(): void {
protected override updateEnabled(): void {
// override on submenu entry
// native menus do not observe enablement on sumbenus
// we mimic that behavior

View File

@ -59,7 +59,7 @@ export class ToggleActionViewItem extends BaseActionViewItem {
this.element.appendChild(this.toggle.domNode);
}
override updateEnabled(): void {
protected override updateEnabled(): void {
if (this.toggle) {
if (this.isEnabled()) {
this.toggle.enable();
@ -69,7 +69,7 @@ export class ToggleActionViewItem extends BaseActionViewItem {
}
}
override updateChecked(): void {
protected override updateChecked(): void {
this.toggle.checked = !!this._action.checked;
}

View File

@ -382,7 +382,7 @@ export class MarkerNavigationWidget extends PeekViewWidget {
this._container.style.height = `${heightInPixel}px`;
}
public override _onWidth(widthInPixel: number): void {
protected override _onWidth(widthInPixel: number): void {
this._message.layout(this._heightInPixel, widthInPixel);
}

View File

@ -816,7 +816,7 @@ CommandsRegistry.registerCommand({
return editor.invokeWithinContext(accessor => {
const command = new class extends GenericGoToLocationAction {
override _getNoResultFoundMessage(info: IWordAtPosition | null) {
protected override _getNoResultFoundMessage(info: IWordAtPosition | null) {
return noResultsMessage || super._getNoResultFoundMessage(info);
}
}({

View File

@ -660,7 +660,7 @@ export class DeleteAllLeftAction extends AbstractDeleteAllToBoundaryAction {
});
}
_getEndCursorState(primaryCursor: Range, rangesToDelete: Range[]): Selection[] {
protected _getEndCursorState(primaryCursor: Range, rangesToDelete: Range[]): Selection[] {
let endPrimaryCursor: Selection | null = null;
const endCursorState: Selection[] = [];
let deletedLines = 0;
@ -690,7 +690,7 @@ export class DeleteAllLeftAction extends AbstractDeleteAllToBoundaryAction {
return endCursorState;
}
_getRangesToDelete(editor: IActiveCodeEditor): Range[] {
protected _getRangesToDelete(editor: IActiveCodeEditor): Range[] {
const selections = editor.getSelections();
if (selections === null) {
return [];
@ -738,7 +738,7 @@ export class DeleteAllRightAction extends AbstractDeleteAllToBoundaryAction {
});
}
_getEndCursorState(primaryCursor: Range, rangesToDelete: Range[]): Selection[] {
protected _getEndCursorState(primaryCursor: Range, rangesToDelete: Range[]): Selection[] {
let endPrimaryCursor: Selection | null = null;
const endCursorState: Selection[] = [];
for (let i = 0, len = rangesToDelete.length, offset = 0; i < len; i++) {
@ -759,7 +759,7 @@ export class DeleteAllRightAction extends AbstractDeleteAllToBoundaryAction {
return endCursorState;
}
_getRangesToDelete(editor: IActiveCodeEditor): Range[] {
protected _getRangesToDelete(editor: IActiveCodeEditor): Range[] {
const model = editor.getModel();
if (model === null) {
return [];

View File

@ -17,7 +17,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
class StatusBarViewItem extends MenuEntryActionViewItem {
override updateLabel() {
protected override updateLabel() {
const kb = this._keybindingService.lookupKeybinding(this._action.id, this._contextKeyService);
if (!kb) {
return super.updateLabel();

View File

@ -195,13 +195,13 @@ export class MenuEntryActionViewItem extends ActionViewItem {
}));
}
override updateLabel(): void {
protected override updateLabel(): void {
if (this.options.label && this.label) {
this.label.textContent = this._commandAction.label;
}
}
override getTooltip() {
protected override getTooltip() {
const keybinding = this._keybindingService.lookupKeybinding(this._commandAction.id, this._contextKeyService);
const keybindingLabel = keybinding && keybinding.getLabel();
@ -222,7 +222,7 @@ export class MenuEntryActionViewItem extends ActionViewItem {
return title;
}
override updateClass(): void {
protected override updateClass(): void {
if (this.options.icon) {
if (this._commandAction !== this._menuItemAction) {
if (this._menuItemAction.alt) {
@ -382,7 +382,7 @@ export class DropdownWithDefaultActionViewItem extends BaseActionViewItem {
this._defaultAction.dispose();
this._defaultAction = this._instaService.createInstance(MenuEntryActionViewItem, lastAction, { keybinding: this._getDefaultActionKeybindingLabel(lastAction) });
this._defaultAction.actionRunner = new class extends ActionRunner {
override async runAction(action: IAction, context?: unknown): Promise<void> {
protected override async runAction(action: IAction, context?: unknown): Promise<void> {
await action.run(undefined);
}
}();

View File

@ -408,7 +408,7 @@ export class GlobalStateInitializer extends AbstractInitializer {
super(SyncResource.GlobalState, userDataProfilesService, environmentService, logService, fileService, storageService, uriIdentityService);
}
async doInitialize(remoteUserData: IRemoteUserData): Promise<void> {
protected async doInitialize(remoteUserData: IRemoteUserData): Promise<void> {
const remoteGlobalState: IGlobalState = remoteUserData.syncData ? JSON.parse(remoteUserData.syncData.content) : null;
if (!remoteGlobalState) {
this.logService.info('Skipping initializing global state because remote global state does not exist.');
@ -506,4 +506,3 @@ export class UserDataSyncStoreTypeSynchronizer {
}
}

View File

@ -15,7 +15,7 @@ import { ExtHostConsoleForwarder } from 'vs/workbench/api/worker/extHostConsoleF
class WorkerRequireInterceptor extends RequireInterceptor {
_installInterceptor() { }
protected _installInterceptor() { }
getModule(request: string, parent: URI): undefined | any {
for (const alternativeModuleName of this._alternatives) {

View File

@ -352,7 +352,7 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker {
super(parent, resource, instantiationService, themeService, configService);
}
_createTree(container: HTMLElement) {
protected _createTree(container: HTMLElement) {
// tree icon theme specials
this._treeContainer.classList.add('file-icon-themable-tree');
@ -388,7 +388,7 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker {
});
}
async _setInput(element: FileElement | OutlineElement2): Promise<void> {
protected async _setInput(element: FileElement | OutlineElement2): Promise<void> {
const { uri, kind } = (element as FileElement);
let input: IWorkspace | URI;
if (kind === FileKind.ROOT_FOLDER) {
@ -420,7 +420,7 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker {
return Disposable.None;
}
async _revealElement(element: IFileStat | IWorkspaceFolder, options: IEditorOptions, sideBySide: boolean): Promise<boolean> {
protected async _revealElement(element: IFileStat | IWorkspaceFolder, options: IEditorOptions, sideBySide: boolean): Promise<boolean> {
if (!isWorkspaceFolder(element) && element.isFile) {
this._onWillPickElement.fire();
await this._editorService.openEditor({ resource: element.resource, options }, sideBySide ? SIDE_GROUP : undefined);
@ -502,7 +502,7 @@ export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker {
return outline.preview(element);
}
async _revealElement(element: any, options: IEditorOptions, sideBySide: boolean): Promise<boolean> {
protected async _revealElement(element: any, options: IEditorOptions, sideBySide: boolean): Promise<boolean> {
this._onWillPickElement.fire();
const outline: IOutline<any> = this._tree.getInput();
await outline.reveal(element, options, sideBySide);

View File

@ -842,7 +842,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
this.centeredLayoutWidget.styles(separatorBorderStyle);
}
override createContentArea(parent: HTMLElement, options?: IEditorPartCreationOptions): HTMLElement {
protected override createContentArea(parent: HTMLElement, options?: IEditorPartCreationOptions): HTMLElement {
// Container
this.element = parent;

View File

@ -79,7 +79,7 @@ export class TextDiffEditor extends AbstractTextEditor<IDiffEditorViewState> imp
return localize('textDiffEditor', "Text Diff Editor");
}
override createEditorControl(parent: HTMLElement, configuration: ICodeEditorOptions): void {
protected override createEditorControl(parent: HTMLElement, configuration: ICodeEditorOptions): void {
this.diffEditorControl = this._register(this.instantiationService.createInstance(DiffEditorWidget, parent, configuration, {}));
}

View File

@ -98,7 +98,7 @@ export class CommandCenterControl {
return label;
}
override getTooltip() {
protected override getTooltip() {
// tooltip: full windowTitle
const kb = keybindingService.lookupKeybinding(action.id)?.getLabel();

View File

@ -127,7 +127,7 @@ export class TreeViewPane extends ViewPane {
return ((this.treeView.dataProvider === undefined) || !!this.treeView.dataProvider.isTreeEmpty) && (this.treeView.message === undefined);
}
override layoutBody(height: number, width: number): void {
protected override layoutBody(height: number, width: number): void {
super.layoutBody(height, width);
this.layoutTreeView(height, width);
}
@ -1377,7 +1377,7 @@ class MultipleSelectionActionRunner extends ActionRunner {
}));
}
override async runAction(action: IAction, context: TreeViewItemHandleArg | TreeViewPaneHandleArg): Promise<void> {
protected override async runAction(action: IAction, context: TreeViewItemHandleArg | TreeViewPaneHandleArg): Promise<void> {
const selection = this.getSelectedResources();
let selectionHandleArgs: TreeViewItemHandleArg[] | undefined = undefined;
let actionInSelected: boolean = false;

View File

@ -123,7 +123,7 @@ export abstract class FilterViewPaneContainer extends ViewPaneContainer {
return views;
}
override onDidAddViewDescriptors(added: IAddedViewDescriptorRef[]): ViewPane[] {
protected override onDidAddViewDescriptors(added: IAddedViewDescriptorRef[]): ViewPane[] {
const panes: ViewPane[] = super.onDidAddViewDescriptors(added);
for (let i = 0; i < added.length; i++) {
if (this.constantViewDescriptors.has(added[i].viewDescriptor.id)) {

View File

@ -152,7 +152,7 @@ export class CommentsPanel extends FilterViewPane implements ICommentsView {
this.filterWidget.checkMoreFilters(!this.filters.showResolved || !this.filters.showUnresolved);
}
public override renderBody(container: HTMLElement): void {
protected override renderBody(container: HTMLElement): void {
super.renderBody(container);
container.classList.add('comments-panel');
@ -242,7 +242,7 @@ export class CommentsPanel extends FilterViewPane implements ICommentsView {
return !!this.tree;
}
public override layoutBodyContent(height: number = this.currentHeight, width: number = this.currentWidth): void {
protected override layoutBodyContent(height: number = this.currentHeight, width: number = this.currentWidth): void {
if (this.messageBoxContainer) {
this.messageBoxContainer.style.height = `${height}px`;
}

View File

@ -32,7 +32,7 @@ export class ReactionActionViewItem extends ActionViewItem {
constructor(action: ReactionAction) {
super(null, action, {});
}
override updateLabel(): void {
protected override updateLabel(): void {
if (!this.label) {
return;
}

View File

@ -258,7 +258,7 @@ export class InteractiveEditor extends EditorPane {
this.#styleElement.textContent = styleSheets.join('\n');
}
override saveState(): void {
protected override saveState(): void {
this.#saveEditorViewState(this.input);
super.saveState();
}

View File

@ -261,7 +261,7 @@ class ToggleMultilineActionViewItem extends ActionViewItem {
this.updateExpandedAttribute();
}
override updateClass(): void {
protected override updateClass(): void {
super.updateClass();
this.updateExpandedAttribute();
}

View File

@ -144,7 +144,7 @@ class NotebookFindFilterActionViewItem extends DropdownMenuActionViewItem {
}
override updateChecked(): void {
protected override updateChecked(): void {
this.element!.classList.toggle('checked', this._action.checked);
}
}
@ -225,7 +225,7 @@ class NotebookFindInput extends FindInput {
this.applyStyles();
}
override applyStyles(): void {
protected override applyStyles(): void {
super.applyStyles();
this._filterButtonContainer.style.borderColor = this._filterChecked && this.inputActiveOptionBorder ? this.inputActiveOptionBorder.toString() : '';

View File

@ -337,7 +337,7 @@ class NotebookFindWidget extends SimpleFindReplaceWidget implements INotebookEdi
}
}
override _updateMatchesCount(): void {
protected override _updateMatchesCount(): void {
if (!this._findModel || !this._findModel.findMatches) {
return;
}

View File

@ -133,7 +133,7 @@ export class NotebookEditor extends EditorPane implements INotebookEditorPane {
return this._widget.value;
}
override setEditorVisible(visible: boolean, group: IEditorGroup | undefined): void {
protected override setEditorVisible(visible: boolean, group: IEditorGroup | undefined): void {
super.setEditorVisible(visible, group);
if (group) {
this._groupListener.clear();

View File

@ -9,7 +9,7 @@ import { MenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryAc
export class CodiconActionViewItem extends MenuEntryActionViewItem {
override updateLabel(): void {
protected override updateLabel(): void {
if (this.options.label && this.label) {
DOM.reset(this.label, ...renderLabelWithIcons(this._commandAction.label ?? ''));
}
@ -27,7 +27,7 @@ export class ActionViewWithLabel extends MenuEntryActionViewItem {
this.updateLabel();
}
override updateLabel() {
protected override updateLabel() {
if (this._actionLabel) {
this._actionLabel.classList.add('notebook-label');
this._actionLabel.innerText = this._action.label;

View File

@ -37,7 +37,7 @@ export class CellDragAndDropPart extends CellContentPart {
super();
}
override didRenderCell(element: ICellViewModel): void {
protected override didRenderCell(element: ICellViewModel): void {
this.update(element);
}

View File

@ -76,7 +76,7 @@ export class BetweenCellToolbar extends CellOverlayPart {
return betweenCellToolbar;
}
override didRenderCell(element: ICellViewModel): void {
protected override didRenderCell(element: ICellViewModel): void {
const betweenCellToolbar = this._initialize();
betweenCellToolbar.context = <INotebookCellActionContext>{
ui: true,

View File

@ -131,7 +131,7 @@ export class KeybindingsEditor extends EditorPane implements IKeybindingsEditorP
this.sortByPrecedenceAction.checked = false;
}
createEditor(parent: HTMLElement): void {
protected createEditor(parent: HTMLElement): void {
const keybindingsEditorElement = DOM.append(parent, $('div', { class: 'keybindings-editor' }));
this.createAriaLabelElement(keybindingsEditorElement);

View File

@ -305,7 +305,7 @@ class DirtyDiffWidget extends PeekViewWidget {
this._disposables.add(this.diffEditor);
}
override _onWidth(width: number): void {
protected override _onWidth(width: number): void {
if (typeof this.height === 'undefined') {
return;
}

View File

@ -124,7 +124,7 @@ export class SearchEditor extends AbstractTextCodeEditor<SearchEditorViewState>
this.searchModel = this._register(this.instantiationService.createInstance(SearchModel));
}
override createEditor(parent: HTMLElement) {
protected override createEditor(parent: HTMLElement) {
DOM.append(parent, this.container);
this.queryEditorContainer = DOM.append(this.container, DOM.$('.query-container'));
const searchResultContainer = DOM.append(this.container, DOM.$('.search-results'));

View File

@ -261,7 +261,7 @@ export class LanguageDetectionWorkerClient extends EditorWorkerClient {
return undefined;
}
override async _getProxy(): Promise<LanguageDetectionSimpleWorker> {
protected override async _getProxy(): Promise<LanguageDetectionSimpleWorker> {
return (await this._getOrCreateLanguageDetectionWorker()).getProxyObject();
}

View File

@ -33,7 +33,7 @@ class ResourceModelCollection extends ReferenceCollection<Promise<IResolvedTextE
super();
}
createReferencedObject(key: string): Promise<IResolvedTextEditorModel> {
protected createReferencedObject(key: string): Promise<IResolvedTextEditorModel> {
return this.doCreateReferencedObject(key);
}
@ -100,7 +100,7 @@ class ResourceModelCollection extends ReferenceCollection<Promise<IResolvedTextE
throw new Error(`Unable to resolve resource ${key}`);
}
destroyReferencedObject(key: string, modelPromise: Promise<ITextEditorModel>): void {
protected destroyReferencedObject(key: string, modelPromise: Promise<ITextEditorModel>): void {
// untitled and inMemory are bound to a different lifecycle
const resource = URI.parse(key);