[clang-tools-extra] r370218 - [clangd][vscode] Don't leak the resources

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 28 08:09:04 PDT 2019


Author: hokein
Date: Wed Aug 28 08:09:04 2019
New Revision: 370218

URL: http://llvm.org/viewvc/llvm-project?rev=370218&view=rev
Log:
[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

Modified:
    clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts

Modified: clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts?rev=370218&r1=370217&r2=370218&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts (original)
+++ clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts Wed Aug 28 08:09:04 2019
@@ -111,6 +111,8 @@ export function activate(context: vscode
                                                 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 @@ export function activate(context: vscode
         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 @@ export function activate(context: vscode
       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(




More information about the cfe-commits mailing list