Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts: enable noImplicitOverride #10737

Merged
merged 2 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
- [plugin] Added support for `vscode.window.createStatusBarItem` [#10754](https://github.com/eclipse-theia/theia/pull/10754) - Contributed on behalf of STMicroelectronics
- [core] Replaced raw WebSocket transport with Socket.io protocol, changed internal APIs accordingly
- [core] Removed all of our own custom HTTP Polling implementation
- In order to cleanup the code base, the constructor signature of the following classes got changed in an API-breaking way:
- `ProblemWidget`
- `FileNavigatorWidget`
- `TerminalServer`
- `TimelineTreeWidget`
- `TypeHierarchyTreeWidget`

## v1.22.0 - 1/27/2022

Expand Down
1 change: 1 addition & 0 deletions configs/base.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"declaration": true,
"declarationMap": true,
"noImplicitAny": true,
"noImplicitOverride": true,
"noEmitOnError": false,
"noImplicitThis": true,
"noUnusedLocals": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class SampleDynamicLabelProviderContribution extends DefaultUriLabelProvi
}, 1000);
}

canHandle(element: object): number {
override canHandle(element: object): number {
if (this.isActive && element.toString().includes('test')) {
return 30;
}
Expand All @@ -54,11 +54,11 @@ export class SampleDynamicLabelProviderContribution extends DefaultUriLabelProvi
});
}

protected getUri(element: URI): URI {
protected override getUri(element: URI): URI {
return new URI(element.toString());
}

getIcon(element: URI): string {
override getIcon(element: URI): string {
const uri = this.getUri(element);
const icon = super.getFileIcon(uri);
if (!icon) {
Expand All @@ -67,10 +67,10 @@ export class SampleDynamicLabelProviderContribution extends DefaultUriLabelProvi
return icon;
}

protected readonly onDidChangeEmitter = new Emitter<DidChangeLabelEvent>();
protected override readonly onDidChangeEmitter = new Emitter<DidChangeLabelEvent>();
private x: number = 0;

getName(element: URI): string | undefined {
override getName(element: URI): string | undefined {
const uri = this.getUri(element);
if (this.isActive && uri.toString().includes('test')) {
return super.getName(uri) + '-' + this.x.toString(10);
Expand All @@ -79,12 +79,12 @@ export class SampleDynamicLabelProviderContribution extends DefaultUriLabelProvi
}
}

getLongName(element: URI): string | undefined {
override getLongName(element: URI): string | undefined {
const uri = this.getUri(element);
return super.getLongName(uri);
}

get onDidChange(): Event<DidChangeLabelEvent> {
override get onDidChange(): Event<DidChangeLabelEvent> {
return this.onDidChangeEmitter.event;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
@injectable()
class SampleBrowserMainMenuFactory extends BrowserMainMenuFactory {

protected handleDefault(menuCommandRegistry: MenuCommandRegistry, menuNode: MenuNode): void {
protected override handleDefault(menuCommandRegistry: MenuCommandRegistry, menuNode: MenuNode): void {
if (menuNode instanceof PlaceholderMenuNode && menuCommandRegistry instanceof SampleMenuCommandRegistry) {
menuCommandRegistry.registerPlaceholderMenu(menuNode);
}
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
protected createMenuCommandRegistry(menu: CompositeMenuNode, args: any[] = []): MenuCommandRegistry {
protected override createMenuCommandRegistry(menu: CompositeMenuNode, args: any[] = []): MenuCommandRegistry {
const menuCommandRegistry = new SampleMenuCommandRegistry(this.services);
this.registerMenu(menuCommandRegistry, menu, args);
return menuCommandRegistry;
}

createMenuWidget(menu: CompositeMenuNode, options: MenuWidget.IOptions & { commands: MenuCommandRegistry }): DynamicMenuWidget {
override createMenuWidget(menu: CompositeMenuNode, options: MenuWidget.IOptions & { commands: MenuCommandRegistry }): DynamicMenuWidget {
return new SampleDynamicMenuWidget(menu, options, this.services);
}

Expand All @@ -60,7 +60,7 @@ class SampleMenuCommandRegistry extends MenuCommandRegistry {
this.placeholders.set(id, menu);
}

snapshot(): this {
override snapshot(): this {
super.snapshot();
for (const menu of this.placeholders.values()) {
this.toDispose.push(this.registerPlaceholder(menu));
Expand All @@ -84,7 +84,7 @@ class SampleMenuCommandRegistry extends MenuCommandRegistry {

class SampleDynamicMenuWidget extends DynamicMenuWidget {

protected handleDefault(menuNode: MenuNode): MenuWidget.IItemOptions[] {
protected override handleDefault(menuNode: MenuNode): MenuWidget.IItemOptions[] {
if (menuNode instanceof PlaceholderMenuNode) {
return [{
command: menuNode.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class SampleUnclosableViewContribution extends AbstractViewContribution<S
});
}

registerCommands(registry: CommandRegistry): void {
override registerCommands(registry: CommandRegistry): void {
super.registerCommands(registry);
registry.registerCommand(SampleToolBarCommand, {
execute: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
class SampleElectronMainMenuFactory extends ElectronMainMenuFactory {

// eslint-disable-next-line @typescript-eslint/no-explicit-any
protected handleElectronDefault(menuNode: CompositeMenuNode, args: any[] = [], options?: ElectronMenuOptions): Electron.MenuItemConstructorOptions[] {
protected override handleElectronDefault(menuNode: CompositeMenuNode, args: any[] = [], options?: ElectronMenuOptions): Electron.MenuItemConstructorOptions[] {
if (menuNode instanceof PlaceholderMenuNode) {
return [{
label: menuNode.label,
Expand Down
2 changes: 1 addition & 1 deletion examples/playwright/src/theia-about-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { TheiaDialog } from './theia-dialog';

export class TheiaAboutDialog extends TheiaDialog {

async isVisible(): Promise<boolean> {
override async isVisible(): Promise<boolean> {
const dialog = await this.page.$(`${this.blockSelector} .theia-aboutDialog`);
return !!dialog && dialog.isVisible();
}
Expand Down
6 changes: 3 additions & 3 deletions examples/playwright/src/theia-explorer-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const TheiaExplorerViewData = {

export class TheiaExplorerFileStatNode extends TheiaTreeNode {

constructor(protected elementHandle: ElementHandle<SVGElement | HTMLElement>, protected explorerView: TheiaExplorerView) {
constructor(protected override elementHandle: ElementHandle<SVGElement | HTMLElement>, protected explorerView: TheiaExplorerView) {
super(elementHandle, explorerView.app);
}

Expand Down Expand Up @@ -64,11 +64,11 @@ export const DOT_FILES_FILTER: TheiaExplorerFileStatNodePredicate = async node =

export class TheiaExplorerView extends TheiaView {

constructor(public app: TheiaApp) {
constructor(app: TheiaApp) {
super(TheiaExplorerViewData, app);
}

async activate(): Promise<void> {
override async activate(): Promise<void> {
await super.activate();
const viewElement = await this.viewElement();
await viewElement?.waitForSelector('.theia-TreeContainer');
Expand Down
2 changes: 1 addition & 1 deletion examples/playwright/src/theia-main-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { TheiaPageObject } from './theia-page-object';
import { normalizeId, toTextContentArray } from './util';

export class TheiaMainMenu extends TheiaMenu {
selector = '.p-Menu.p-MenuBar-menu';
override selector = '.p-Menu.p-MenuBar-menu';
}

export class TheiaMenuBar extends TheiaPageObject {
Expand Down
4 changes: 2 additions & 2 deletions examples/playwright/src/theia-notification-indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ export class TheiaNotificationIndicator extends TheiaStatusIndicator {
return 'Notification';
}

async isVisible(): Promise<boolean> {
override async isVisible(): Promise<boolean> {
return super.isVisible(NOTIFICATION_ICONS, this.title);
}

async hasNotifications(): Promise<boolean> {
return super.isVisible(NOTIFICATION_DOT_ICON, this.title);
}

async waitForVisible(expectNotifications = false): Promise<void> {
override async waitForVisible(expectNotifications = false): Promise<void> {
await super.waitForVisibleByIcon(expectNotifications ? NOTIFICATION_DOT_ICON : NOTIFICATION_ICON);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/playwright/src/theia-notification-overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class TheiaNotificationOverlay extends TheiaPageObject {
protected readonly HEADER_NOTIFICATIONS = 'NOTIFICATIONS';
protected readonly HEADER_NO_NOTIFICATIONS = 'NO NEW NOTIFICATIONS';

constructor(public app: TheiaApp, protected notificationIndicator: TheiaNotificationIndicator) {
constructor(app: TheiaApp, protected notificationIndicator: TheiaNotificationIndicator) {
super(app);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/playwright/src/theia-preference-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class TheiaPreferenceView extends TheiaView {
super(TheiaSettingsViewData, app);
}

async open(preferenceScope = TheiaPreferenceScope.Workspace): Promise<TheiaView> {
override async open(preferenceScope = TheiaPreferenceScope.Workspace): Promise<TheiaView> {
await this.app.quickCommandPalette.trigger('Preferences: Open Settings (UI)');
await this.waitForVisible();
await this.openPreferenceScope(preferenceScope);
Expand Down
2 changes: 1 addition & 1 deletion examples/playwright/src/theia-problem-indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const PROBLEM_ICON = 'codicon-error';

export class TheiaProblemIndicator extends TheiaStatusIndicator {

async isVisible(): Promise<boolean> {
override async isVisible(): Promise<boolean> {
const handle = await super.getElementHandleByIcon(PROBLEM_ICON);
return !!handle && handle.isVisible();
}
Expand Down
2 changes: 1 addition & 1 deletion examples/playwright/src/theia-toggle-bottom-indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { TheiaStatusIndicator } from './theia-status-indicator';
const TOGGLE_BOTTOM_ICON = 'codicon-window';

export class TheiaToggleBottomIndicator extends TheiaStatusIndicator {
async isVisible(): Promise<boolean> {
override async isVisible(): Promise<boolean> {
return super.isVisible(TOGGLE_BOTTOM_ICON);
}
}
4 changes: 2 additions & 2 deletions packages/bulk-edit/src/browser/bulk-edit-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class BulkEditContribution extends AbstractViewContribution<BulkEditTreeW
private edits: monaco.editor.ResourceEdit[];

@inject(QuickViewService) @optional()
protected readonly quickView: QuickViewService;
protected override readonly quickView: QuickViewService;

constructor(private readonly bulkEditService: MonacoBulkEditService) {
super({
Expand All @@ -43,7 +43,7 @@ export class BulkEditContribution extends AbstractViewContribution<BulkEditTreeW
this.bulkEditService.setPreviewHandler((edits: monaco.editor.ResourceEdit[]) => this.previewEdit(edits));
}

registerCommands(registry: CommandRegistry): void {
override registerCommands(registry: CommandRegistry): void {
super.registerCommands(registry);
this.quickView?.hideItem(BULK_EDIT_WIDGET_NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export namespace BulkEditNodeSelection {
export class CommandHandler extends SelectionCommandHandler<BulkEditNodeSelection> {

constructor(
protected readonly selectionService: SelectionService,
protected readonly options: SelectionCommandHandler.Options<BulkEditNodeSelection>
protected override readonly selectionService: SelectionService,
protected override readonly options: SelectionCommandHandler.Options<BulkEditNodeSelection>
) {
super(
selectionService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import { TreeModelImpl, OpenerService, open, TreeNode } from '@theia/core/lib/br

@injectable()
export class BulkEditTreeModel extends TreeModelImpl {
@inject(BulkEditTree) protected readonly tree: BulkEditTree;
@inject(BulkEditTree) protected override readonly tree: BulkEditTree;
@inject(OpenerService) protected readonly openerService: OpenerService;

protected doOpenNode(node: TreeNode): void {
protected override doOpenNode(node: TreeNode): void {
if (BulkEditNode.is(node)) {
open(this.openerService, node.uri, undefined);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export class BulkEditTreeWidget extends TreeWidget {

constructor(
@inject(TreeProps) readonly treeProps: TreeProps,
@inject(BulkEditTreeModel) readonly model: BulkEditTreeModel,
@inject(ContextMenuRenderer) readonly contextMenuRenderer: ContextMenuRenderer
@inject(BulkEditTreeModel) override readonly model: BulkEditTreeModel,
@inject(ContextMenuRenderer) override readonly contextMenuRenderer: ContextMenuRenderer
) {
super(treeProps, model, contextMenuRenderer);

Expand All @@ -68,37 +68,37 @@ export class BulkEditTreeWidget extends TreeWidget {
this.quickView?.showItem(BULK_EDIT_WIDGET_NAME);
}

protected handleClickEvent(node: TreeNode | undefined, event: React.MouseEvent<HTMLElement>): void {
protected override handleClickEvent(node: TreeNode | undefined, event: React.MouseEvent<HTMLElement>): void {
super.handleClickEvent(node, event);
if (BulkEditNode.is(node)) {
this.doOpen(node);
}
}

protected handleDown(event: KeyboardEvent): void {
protected override handleDown(event: KeyboardEvent): void {
const node = this.model.getNextSelectableNode();
super.handleDown(event);
if (BulkEditNode.is(node)) {
this.doOpen(node);
}
}

protected handleUp(event: KeyboardEvent): void {
protected override handleUp(event: KeyboardEvent): void {
const node = this.model.getPrevSelectableNode();
super.handleUp(event);
if (BulkEditNode.is(node)) {
this.doOpen(node);
}
}

protected renderTree(model: TreeModel): React.ReactNode {
protected override renderTree(model: TreeModel): React.ReactNode {
if (CompositeTreeNode.is(model.root) && model.root.children.length > 0) {
return super.renderTree(model);
}
return <div className='theia-widget-noInfo noEdits'>{nls.localizeByDefault('No edits have been detected in the workspace so far.')}</div>;
}

protected renderCaption(node: TreeNode, props: NodeProps): React.ReactNode {
protected override renderCaption(node: TreeNode, props: NodeProps): React.ReactNode {
if (BulkEditInfoNode.is(node)) {
return this.decorateBulkEditInfoNode(node);
} else if (BulkEditNode.is(node)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ export class CallHierarchyContribution extends AbstractViewContribution<CallHier
return !!selection && !!languageId && !!this.callHierarchyServiceProvider.get(languageId, new URI(selection.uri));
}

async openView(args?: Partial<OpenViewArguments>): Promise<CallHierarchyTreeWidget> {
override async openView(args?: Partial<OpenViewArguments>): Promise<CallHierarchyTreeWidget> {
const widget = await super.openView(args);
const { selection, languageId } = this.editorAccess;
widget.initializeModel(selection, languageId);
return widget;
}

registerCommands(commands: CommandRegistry): void {
override registerCommands(commands: CommandRegistry): void {
commands.registerCommand(CallHierarchyCommands.OPEN, {
execute: () => this.openView({
toggle: false,
Expand All @@ -86,7 +86,7 @@ export class CallHierarchyContribution extends AbstractViewContribution<CallHier
super.registerCommands(commands);
}

registerMenus(menus: MenuModelRegistry): void {
override registerMenus(menus: MenuModelRegistry): void {
const menuPath = [...EDITOR_CONTEXT_MENU, 'navigation'];
menus.registerMenuAction(menuPath, {
commandId: CallHierarchyCommands.OPEN.id,
Expand All @@ -95,7 +95,7 @@ export class CallHierarchyContribution extends AbstractViewContribution<CallHier
super.registerMenus(menus);
}

registerKeybindings(keybindings: KeybindingRegistry): void {
override registerKeybindings(keybindings: KeybindingRegistry): void {
super.registerKeybindings(keybindings);
keybindings.registerKeybinding({
command: CallHierarchyCommands.OPEN.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class CallHierarchyTreeModel extends TreeModelImpl {

private _languageId: string | undefined;

@inject(CallHierarchyTree) protected readonly tree: CallHierarchyTree;
@inject(CallHierarchyTree) protected override readonly tree: CallHierarchyTree;
@inject(CallHierarchyServiceProvider) protected readonly callHierarchyServiceProvider: CallHierarchyServiceProvider;

getTree(): CallHierarchyTree {
Expand Down Expand Up @@ -63,7 +63,7 @@ export class CallHierarchyTreeModel extends TreeModelImpl {
}
}

protected doOpenNode(node: TreeNode): void {
protected override doOpenNode(node: TreeNode): void {
// do nothing (in particular do not expand the node)
}
}
Loading