[PATCH] D66735: [clangd] Handling text editor/document lifetimes in vscode extension.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 26 06:14:00 PDT 2019
hokein added inline comments.
================
Comment at: clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts:94
+ vscode.window.onDidChangeVisibleTextEditors(
+ () => this.highlighter.onDidChangeVisibleTextEditors());
+ vscode.workspace.onDidCloseTextDocument(
----------------
jvikstrom wrote:
> hokein wrote:
> > I think we can do it like `vscode.window.onDidChangeVisibleTextEditors((TextEditor[] editors) => { // call applyHighlight for each text editor })`.
> There might be TextEditors that are not a c++ file/haven't gotten highlightings yet.
>
> So we'd still need to do the this.files.has(fileUri) check which we also do in the initialize function.
>
> Maybe I should just expose the reapplyAllHighlightings function and call that one instead?
if the file is not a c++, the current implementation of `applyHighlights` is tolerant with that I think, it doesn't do anything (we get an empty decoration ranges).
I think we can do the ` this.files.has(fileUri)` check in `applyHighlights`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66735/new/
https://reviews.llvm.org/D66735
More information about the cfe-commits
mailing list