summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/Protocol.cpp
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2019-06-04 09:36:59 +0000
committerIlya Biryukov <ibiryukov@google.com>2019-06-04 09:36:59 +0000
commit4ef0f82b71dedeb11d2ff40c6a68ac2737f07f59 (patch)
tree7a46f384bd75b6a6be92f929a7429ae5f3fc2857 /clang-tools-extra/clangd/Protocol.cpp
parent63846039f574a584714ef10777a6ea4c4e5706fd (diff)
downloadbcm5719-llvm-4ef0f82b71dedeb11d2ff40c6a68ac2737f07f59.tar.gz
bcm5719-llvm-4ef0f82b71dedeb11d2ff40c6a68ac2737f07f59.zip
[clangd] Support offsets for parameters in signatureHelp
Summary: Added to LSP in version 3.14 Reviewers: hokein Reviewed By: hokein Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62476 llvm-svn: 362481
Diffstat (limited to 'clang-tools-extra/clangd/Protocol.cpp')
-rw-r--r--clang-tools-extra/clangd/Protocol.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp
index 51316fefd1f..5c5912eb9bc 100644
--- a/clang-tools-extra/clangd/Protocol.cpp
+++ b/clang-tools-extra/clangd/Protocol.cpp
@@ -314,6 +314,14 @@ bool fromJSON(const llvm::json::Value &Params, ClientCapabilities &R) {
}
}
}
+ if (auto *Help = TextDocument->getObject("signatureHelp")) {
+ if (auto *Info = Help->getObject("signatureInformation")) {
+ if (auto *Parameter = Info->getObject("parameterInformation")) {
+ if (auto OffsetSupport = Parameter->getBoolean("labelOffsetSupport"))
+ R.OffsetsInSignatureHelp = *OffsetSupport;
+ }
+ }
+ }
}
if (auto *Workspace = O->getObject("workspace")) {
if (auto *Symbol = Workspace->getObject("symbol")) {
@@ -824,8 +832,14 @@ llvm::json::Value toJSON(const CompletionList &L) {
}
llvm::json::Value toJSON(const ParameterInformation &PI) {
- assert(!PI.label.empty() && "parameter information label is required");
- llvm::json::Object Result{{"label", PI.label}};
+ assert(PI.labelOffsets.hasValue() ||
+ !PI.labelString.empty() && "parameter information label is required");
+ llvm::json::Object Result;
+ if (PI.labelOffsets)
+ Result["label"] =
+ llvm::json::Array({PI.labelOffsets->first, PI.labelOffsets->second});
+ else
+ Result["label"] = PI.labelString;
if (!PI.documentation.empty())
Result["documentation"] = PI.documentation;
return std::move(Result);
OpenPOWER on IntegriCloud