diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 15e1a0873dea..1778c4e9f417 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts @@ -68,7 +68,7 @@ PATH=${process.env.PATH} // This also requires considering our settings strategy, which is work which needs doing // @ts-ignore The tracer is private to vscode-languageclient, but we need access to it to not log publishDecorations requests res._tracer = { - log: (messageOrDataObject: string | any, data?: string) => { + log: (messageOrDataObject: string | unknown, data?: string) => { if (typeof messageOrDataObject === 'string') { if ( messageOrDataObject.includes( diff --git a/editors/code/src/color_theme.ts b/editors/code/src/color_theme.ts index 71113d374ebb..7e10c7f79ec3 100644 --- a/editors/code/src/color_theme.ts +++ b/editors/code/src/color_theme.ts @@ -61,7 +61,7 @@ export class ColorTheme { } function loadThemeNamed(themeName: string): ColorTheme { - function isTheme(extension: vscode.Extension): boolean { + function isTheme(extension: vscode.Extension): boolean { return ( extension.extensionKind === vscode.ExtensionKind.UI && extension.packageJSON.contributes && diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts index 02ea9f166782..211f2251f251 100644 --- a/editors/code/src/commands/syntax_tree.ts +++ b/editors/code/src/commands/syntax_tree.ts @@ -55,7 +55,7 @@ export function syntaxTree(ctx: Ctx): Cmd { // We need to order this after LS updates, but there's no API for that. // Hence, good old setTimeout. -function afterLs(f: () => any) { +function afterLs(f: () => void) { setTimeout(f, 10); } diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index 094566d09fef..05d21ae56f62 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -1,5 +1,6 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; + import { Config } from './config'; import { createClient } from './client'; @@ -52,12 +53,12 @@ export class Ctx { overrideCommand(name: string, factory: (ctx: Ctx) => Cmd) { const defaultCmd = `default:${name}`; const override = factory(this); - const original = (...args: any[]) => + const original = (...args: unknown[]) => vscode.commands.executeCommand(defaultCmd, ...args); try { const d = vscode.commands.registerCommand( name, - async (...args: any[]) => { + async (...args: unknown[]) => { if (!(await override(...args))) { return await original(...args); } @@ -73,11 +74,11 @@ export class Ctx { } } - get subscriptions(): { dispose(): any }[] { + get subscriptions(): Disposable[] { return this.extCtx.subscriptions; } - pushCleanup(d: { dispose(): any }) { + pushCleanup(d: Disposable) { this.extCtx.subscriptions.push(d); } @@ -86,12 +87,15 @@ export class Ctx { } } -export type Cmd = (...args: any[]) => any; +export interface Disposable { + dispose(): void; +} +export type Cmd = (...args: any[]) => unknown; export async function sendRequestWithRetry( client: lc.LanguageClient, method: string, - param: any, + param: unknown, token?: vscode.CancellationToken, ): Promise { for (const delay of [2, 4, 6, 8, 10, null]) { diff --git a/editors/code/src/status_display.ts b/editors/code/src/status_display.ts index 7345bc3f5099..4317410c7ef5 100644 --- a/editors/code/src/status_display.ts +++ b/editors/code/src/status_display.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; -import { WorkDoneProgress, WorkDoneProgressBegin, WorkDoneProgressReport, WorkDoneProgressEnd } from 'vscode-languageclient'; +import { WorkDoneProgress, WorkDoneProgressBegin, WorkDoneProgressReport, WorkDoneProgressEnd, Disposable } from 'vscode-languageclient'; import { Ctx } from './ctx'; @@ -14,7 +14,7 @@ export function activateStatusDisplay(ctx: Ctx) { }); } -class StatusDisplay implements vscode.Disposable { +class StatusDisplay implements vscode.Disposable, Disposable { packageName?: string; private i: number = 0;