vscode: use void where possible

This commit is contained in:
Veetaha
2020-02-02 23:23:01 +02:00
parent 5411d65a7f
commit 2fd7af2a62
3 changed files with 9 additions and 5 deletions

View File

@@ -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. // We need to order this after LS updates, but there's no API for that.
// Hence, good old setTimeout. // Hence, good old setTimeout.
function afterLs(f: () => unknown) { function afterLs(f: () => void) {
setTimeout(f, 10); setTimeout(f, 10);
} }

View File

@@ -1,5 +1,6 @@
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as lc from 'vscode-languageclient'; import * as lc from 'vscode-languageclient';
import { Config } from './config'; import { Config } from './config';
import { createClient } from './client'; import { createClient } from './client';
@@ -73,11 +74,11 @@ export class Ctx {
} }
} }
get subscriptions(): { dispose(): unknown }[] { get subscriptions(): Disposable[] {
return this.extCtx.subscriptions; return this.extCtx.subscriptions;
} }
pushCleanup(d: { dispose(): unknown }) { pushCleanup(d: Disposable) {
this.extCtx.subscriptions.push(d); this.extCtx.subscriptions.push(d);
} }
@@ -86,6 +87,9 @@ export class Ctx {
} }
} }
export interface Disposable {
dispose(): void;
}
export type Cmd = (...args: any[]) => unknown; export type Cmd = (...args: any[]) => unknown;
export async function sendRequestWithRetry<R>( export async function sendRequestWithRetry<R>(

View File

@@ -1,6 +1,6 @@
import * as vscode from 'vscode'; 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'; 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; packageName?: string;
private i: number = 0; private i: number = 0;