[clangd] extend the publishDiagnostics response to send back fixits to the
client if the client supports this extension

This commit extends the 'textDocument/publishDiagnostics' notification sent from
Clangd to the client.  When it's enabled, Clangd sends out the fixits associated
with the appropriate diagnostic in the body of the 'publishDiagnostics'
notification. The client can enable this extension by setting 'clangdFixSupport'
to true in the textDocument capabilities during initialization.

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

llvm-svn: 339454
diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp
index 202fbfb..698bb04 100644
--- a/clang-tools-extra/clangd/Protocol.cpp
+++ b/clang-tools-extra/clangd/Protocol.cpp
@@ -178,6 +178,15 @@
   return true;
 }
 
+bool fromJSON(const llvm::json::Value &Params,
+              PublishDiagnosticsClientCapabilities &R) {
+  json::ObjectMapper O(Params);
+  if (!O)
+    return false;
+  O.map("clangdFixSupport", R.clangdFixSupport);
+  return true;
+}
+
 bool fromJSON(const json::Value &E, SymbolKind &Out) {
   if (auto T = E.getAsInteger()) {
     if (*T < static_cast<int>(SymbolKind::File) ||
@@ -240,6 +249,7 @@
   if (!O)
     return false;
   O.map("completion", R.completion);
+  O.map("publishDiagnostics", R.publishDiagnostics);
   return true;
 }