diff options
author | Sam McCall <sam.mccall@gmail.com> | 2018-10-24 07:59:38 +0000 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2018-10-24 07:59:38 +0000 |
commit | 16e7070e3e7640f0f081a84ec72b2a8d81f2a668 (patch) | |
tree | bfb763d0f6a6872c9a26ba20ebccf3164a755145 /clang-tools-extra/clangd/Diagnostics.h | |
parent | 1f54500af04bcdc2a4cd41b154778abf691ed300 (diff) | |
download | bcm5719-llvm-16e7070e3e7640f0f081a84ec72b2a8d81f2a668.tar.gz bcm5719-llvm-16e7070e3e7640f0f081a84ec72b2a8d81f2a668.zip |
[clangd] Embed fixes as CodeAction, instead of clangd_fixes. Clean up serialization.
Summary:
CodeAction provides us with a standard way of representing fixes inline, so
use it, replacing our existing ad-hoc extension.
After this, it's easy to serialize diagnostics using the structured
toJSON/Protocol.h mechanism rather than assembling JSON ad-hoc.
Reviewers: hokein, arphaman
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D53391
llvm-svn: 345119
Diffstat (limited to 'clang-tools-extra/clangd/Diagnostics.h')
-rw-r--r-- | clang-tools-extra/clangd/Diagnostics.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/Diagnostics.h b/clang-tools-extra/clangd/Diagnostics.h index 0cdaeac161e..6318e88fc4e 100644 --- a/clang-tools-extra/clangd/Diagnostics.h +++ b/clang-tools-extra/clangd/Diagnostics.h @@ -78,9 +78,12 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Diag &D); /// file do not have a corresponding LSP diagnostic, but can still be included /// as part of their main diagnostic's message. void toLSPDiags( - const Diag &D, + const Diag &D, const URIForFile &File, const ClangdDiagnosticOptions &Opts, llvm::function_ref<void(clangd::Diagnostic, llvm::ArrayRef<Fix>)> OutFn); +/// Convert from Fix to LSP CodeAction. +CodeAction toCodeAction(const Fix &D, const URIForFile &File); + /// Convert from clang diagnostic level to LSP severity. int getSeverity(DiagnosticsEngine::Level L); |