[clangd][vscode] Don't leak the resources
Summary: We miss a few places where we need to add them to the subscriptions.
Reviewers: jvikstrom
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66881
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@370218 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/clangd/clients/clangd-vscode/src/extension.ts b/clangd/clients/clangd-vscode/src/extension.ts
index f06b2f1..fa787f9 100644
--- a/clangd/clients/clangd-vscode/src/extension.ts
+++ b/clangd/clients/clangd-vscode/src/extension.ts
@@ -111,6 +111,8 @@
serverOptions, clientOptions);
const semanticHighlightingFeature =
new semanticHighlighting.SemanticHighlightingFeature();
+ context.subscriptions.push(
+ vscode.Disposable.from(semanticHighlightingFeature));
clangdClient.registerFeature(semanticHighlightingFeature);
console.log('Clang Language Server is now active!');
context.subscriptions.push(clangdClient.start());
@@ -133,9 +135,10 @@
vscode.window.showTextDocument(doc);
}));
const status = new FileStatus();
+ context.subscriptions.push(vscode.Disposable.from(status));
context.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(
() => { status.updateStatus(); }));
- clangdClient.onDidChangeState(({newState}) => {
+ context.subscriptions.push(clangdClient.onDidChangeState(({newState}) => {
if (newState == vscodelc.State.Running) {
// clangd starts or restarts after crash.
clangdClient.onNotification(
@@ -150,7 +153,7 @@
status.clear();
semanticHighlightingFeature.dispose();
}
- })
+ }));
// An empty place holder for the activate command, otherwise we'll get an
// "command is not registered" error.
context.subscriptions.push(vscode.commands.registerCommand(