[clangd] Send empty diagnostics when a file is closed
authorIlya Biryukov <ibiryukov@google.com>
Mon, 25 Mar 2019 10:15:11 +0000 (10:15 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Mon, 25 Mar 2019 10:15:11 +0000 (10:15 +0000)
commit49c10713945b8ed631d4de7f912558827440bede
treec7cd2b8c93b9c4cb1b8c2b084a922bf4ee702b4b
parenta5a4bb69c16f55b7c7dc526c813d5218a824dbfa
[clangd] Send empty diagnostics when a file is closed

Summary:
The LSP clients cannot know clangd will not send diagnostic updates
for closed files, so we send them an empty list of diagnostics to
avoid showing stale diagnostics for closed files in the UI, e.g. in the
"Problems" pane of VSCode.

Fixes PR41217.

Reviewers: hokein

Reviewed By: hokein

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D59757

llvm-svn: 356880
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/ClangdLSPServer.h
clang-tools-extra/test/clangd/diagnostics.test