mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Simplify startup
This commit is contained in:
parent
dcdbbddd16
commit
d24e612106
5 changed files with 25 additions and 33 deletions
|
@ -17,7 +17,6 @@ export class Ctx {
|
|||
// on the event loop to get a better picture of what we can do here)
|
||||
client: lc.LanguageClient | null = null;
|
||||
private extCtx: vscode.ExtensionContext;
|
||||
private onStartHooks: Array<(client: lc.LanguageClient) => void> = [];
|
||||
|
||||
constructor(extCtx: vscode.ExtensionContext) {
|
||||
this.config = new Config(extCtx);
|
||||
|
@ -39,9 +38,6 @@ export class Ctx {
|
|||
await client.onReady();
|
||||
|
||||
this.client = client;
|
||||
for (const hook of this.onStartHooks) {
|
||||
hook(client);
|
||||
}
|
||||
}
|
||||
|
||||
get activeRustEditor(): vscode.TextEditor | undefined {
|
||||
|
@ -69,15 +65,6 @@ export class Ctx {
|
|||
pushCleanup(d: Disposable) {
|
||||
this.extCtx.subscriptions.push(d);
|
||||
}
|
||||
|
||||
onStart(hook: (client: lc.LanguageClient) => void) {
|
||||
const client = this.client;
|
||||
if (client == null) {
|
||||
this.onStartHooks.push(hook);
|
||||
} else {
|
||||
hook(client)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface Disposable {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue