diff options
author | Veetaha <[email protected]> | 2020-02-02 21:23:01 +0000 |
---|---|---|
committer | Veetaha <[email protected]> | 2020-02-02 21:24:09 +0000 |
commit | 2fd7af2a62ce0c8acb5daa6b2c179b638318f31a (patch) | |
tree | 2b51c5ea7f7cbda460ea08c535a2f56489295543 | |
parent | 5411d65a7f8b86da46aeef23bb2c707408766135 (diff) |
vscode: use void where possible
-rw-r--r-- | editors/code/src/commands/syntax_tree.ts | 2 | ||||
-rw-r--r-- | editors/code/src/ctx.ts | 8 | ||||
-rw-r--r-- | editors/code/src/status_display.ts | 4 |
3 files changed, 9 insertions, 5 deletions
diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts index 562df50cd..211f2251f 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 { | |||
55 | 55 | ||
56 | // We need to order this after LS updates, but there's no API for that. | 56 | // We need to order this after LS updates, but there's no API for that. |
57 | // Hence, good old setTimeout. | 57 | // Hence, good old setTimeout. |
58 | function afterLs(f: () => unknown) { | 58 | function afterLs(f: () => void) { |
59 | setTimeout(f, 10); | 59 | setTimeout(f, 10); |
60 | } | 60 | } |
61 | 61 | ||
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index 2d703af58..05d21ae56 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | import * as lc from 'vscode-languageclient'; | 2 | import * as lc from 'vscode-languageclient'; |
3 | |||
3 | import { Config } from './config'; | 4 | import { Config } from './config'; |
4 | import { createClient } from './client'; | 5 | import { createClient } from './client'; |
5 | 6 | ||
@@ -73,11 +74,11 @@ export class Ctx { | |||
73 | } | 74 | } |
74 | } | 75 | } |
75 | 76 | ||
76 | get subscriptions(): { dispose(): unknown }[] { | 77 | get subscriptions(): Disposable[] { |
77 | return this.extCtx.subscriptions; | 78 | return this.extCtx.subscriptions; |
78 | } | 79 | } |
79 | 80 | ||
80 | pushCleanup(d: { dispose(): unknown }) { | 81 | pushCleanup(d: Disposable) { |
81 | this.extCtx.subscriptions.push(d); | 82 | this.extCtx.subscriptions.push(d); |
82 | } | 83 | } |
83 | 84 | ||
@@ -86,6 +87,9 @@ export class Ctx { | |||
86 | } | 87 | } |
87 | } | 88 | } |
88 | 89 | ||
90 | export interface Disposable { | ||
91 | dispose(): void; | ||
92 | } | ||
89 | export type Cmd = (...args: any[]) => unknown; | 93 | export type Cmd = (...args: any[]) => unknown; |
90 | 94 | ||
91 | export async function sendRequestWithRetry<R>( | 95 | export async function sendRequestWithRetry<R>( |
diff --git a/editors/code/src/status_display.ts b/editors/code/src/status_display.ts index 7345bc3f5..4317410c7 100644 --- a/editors/code/src/status_display.ts +++ b/editors/code/src/status_display.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | 2 | ||
3 | import { WorkDoneProgress, WorkDoneProgressBegin, WorkDoneProgressReport, WorkDoneProgressEnd } from 'vscode-languageclient'; | 3 | import { WorkDoneProgress, WorkDoneProgressBegin, WorkDoneProgressReport, WorkDoneProgressEnd, Disposable } from 'vscode-languageclient'; |
4 | 4 | ||
5 | import { Ctx } from './ctx'; | 5 | import { Ctx } from './ctx'; |
6 | 6 | ||
@@ -14,7 +14,7 @@ export function activateStatusDisplay(ctx: Ctx) { | |||
14 | }); | 14 | }); |
15 | } | 15 | } |
16 | 16 | ||
17 | class StatusDisplay implements vscode.Disposable { | 17 | class StatusDisplay implements vscode.Disposable, Disposable { |
18 | packageName?: string; | 18 | packageName?: string; |
19 | 19 | ||
20 | private i: number = 0; | 20 | private i: number = 0; |