[clang-tools-extra] 6f7dca9 - [clangd] Send InitializeResult.serverInfo
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 3 03:26:10 PST 2020
Author: Sam McCall
Date: 2020-03-03T12:25:58+01:00
New Revision: 6f7dca97fb3c07ffae0c39b9754a387ca014d5ff
URL: https://github.com/llvm/llvm-project/commit/6f7dca97fb3c07ffae0c39b9754a387ca014d5ff
DIFF: https://github.com/llvm/llvm-project/commit/6f7dca97fb3c07ffae0c39b9754a387ca014d5ff.diff
LOG: [clangd] Send InitializeResult.serverInfo
Added:
Modified:
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/test/initialize-params.test
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index 18682866d800..e6d077b11885 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -18,6 +18,7 @@
#include "Trace.h"
#include "URI.h"
#include "refactor/Tweak.h"
+#include "clang/Basic/Version.h"
#include "clang/Tooling/Core/Replacement.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
@@ -546,7 +547,10 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
CodeAction::INFO_KIND}}};
llvm::json::Object Result{
- {{"capabilities",
+ {{"serverInfo",
+ llvm::json::Object{{"name", "clangd"},
+ {"version", getClangToolFullVersion("clangd")}}},
+ {"capabilities",
llvm::json::Object{
{"textDocumentSync", (int)TextDocumentSyncKind::Incremental},
{"documentFormattingProvider", true},
diff --git a/clang-tools-extra/clangd/test/initialize-params.test b/clang-tools-extra/clangd/test/initialize-params.test
index 68e3ebc24a21..2b5c02fc8ce2 100644
--- a/clang-tools-extra/clangd/test/initialize-params.test
+++ b/clang-tools-extra/clangd/test/initialize-params.test
@@ -47,6 +47,10 @@
# CHECK-NEXT: "textDocumentSync": 2,
# CHECK-NEXT: "typeHierarchyProvider": true
# CHECK-NEXT: "workspaceSymbolProvider": true
+# CHECK-NEXT: },
+# CHECK-NEXT: "serverInfo": {
+# CHECK-NEXT: "name": "clangd",
+# CHECK-NEXT: "version": "{{.*}}clangd version {{.*}}"
# CHECK-NEXT: }
# CHECK-NEXT: }
---
More information about the cfe-commits
mailing list