mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
vscode extension: migrate from any to unknown where possible
This commit is contained in:
parent
4bf5f59560
commit
12d0970f7e
@ -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(
|
||||
|
@ -61,7 +61,7 @@ export class ColorTheme {
|
||||
}
|
||||
|
||||
function loadThemeNamed(themeName: string): ColorTheme {
|
||||
function isTheme(extension: vscode.Extension<any>): boolean {
|
||||
function isTheme(extension: vscode.Extension<unknown>): boolean {
|
||||
return (
|
||||
extension.extensionKind === vscode.ExtensionKind.UI &&
|
||||
extension.packageJSON.contributes &&
|
||||
|
@ -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: () => unknown) {
|
||||
setTimeout(f, 10);
|
||||
}
|
||||
|
||||
|
@ -52,12 +52,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 +73,11 @@ export class Ctx {
|
||||
}
|
||||
}
|
||||
|
||||
get subscriptions(): { dispose(): any }[] {
|
||||
get subscriptions(): { dispose(): unknown }[] {
|
||||
return this.extCtx.subscriptions;
|
||||
}
|
||||
|
||||
pushCleanup(d: { dispose(): any }) {
|
||||
pushCleanup(d: { dispose(): unknown }) {
|
||||
this.extCtx.subscriptions.push(d);
|
||||
}
|
||||
|
||||
@ -86,12 +86,12 @@ export class Ctx {
|
||||
}
|
||||
}
|
||||
|
||||
export type Cmd = (...args: any[]) => any;
|
||||
export type Cmd = (...args: unknown[]) => unknown;
|
||||
|
||||
export async function sendRequestWithRetry<R>(
|
||||
client: lc.LanguageClient,
|
||||
method: string,
|
||||
param: any,
|
||||
param: unknown,
|
||||
token?: vscode.CancellationToken,
|
||||
): Promise<R> {
|
||||
for (const delay of [2, 4, 6, 8, 10, null]) {
|
||||
|
Loading…
Reference in New Issue
Block a user