[PATCH] D56540: [clangd] Clean the cache of file statuses on vscode-clangd when clangd crashes.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 24 06:26:27 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE352049: [clangd] Clean the cache of file statuses on vscode-clangd when clangd crashes. (authored by hokein, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D56540?vs=181035&id=183298#toc
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56540/new/
https://reviews.llvm.org/D56540
Files:
clangd/clients/clangd-vscode/src/extension.ts
Index: clangd/clients/clangd-vscode/src/extension.ts
===================================================================
--- clangd/clients/clangd-vscode/src/extension.ts
+++ clangd/clients/clangd-vscode/src/extension.ts
@@ -40,6 +40,11 @@
this.statusBarItem.show();
}
+ clear() {
+ this.statuses.clear();
+ this.statusBarItem.hide();
+ }
+
dispose() {
this.statusBarItem.dispose();
}
@@ -112,9 +117,16 @@
context.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(() => {
status.updateStatus();
}));
- clangdClient.onReady().then(() => {
- clangdClient.onNotification(
- 'textDocument/clangd.fileStatus',
- (fileStatus) => { status.onFileUpdated(fileStatus); });
- })
+ clangdClient.onDidChangeState(
+ ({ newState }) => {
+ if (newState == vscodelc.State.Running) {
+ // clangd starts or restarts after crash.
+ clangdClient.onNotification(
+ 'textDocument/clangd.fileStatus',
+ (fileStatus) => { status.onFileUpdated(fileStatus); });
+ } else if (newState == vscodelc.State.Stopped) {
+ // Clear all cached statuses when clangd crashes.
+ status.clear();
+ }
+ })
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56540.183298.patch
Type: text/x-patch
Size: 1337 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190124/41e5d677/attachment.bin>
More information about the cfe-commits
mailing list