[clang-tools-extra] [clangd] Check for editsNearCursor client capability under experimental capabilities (PR #114699)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 3 00:45:11 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clangd
Author: Nathan Ridge (HighCommander4)
<details>
<summary>Changes</summary>
This is done to support clients which only support adding custom (language-specific or server-specific) capabilities under 'experimental'.
Fixes https://github.com/clangd/clangd/issues/2201
---
Full diff: https://github.com/llvm/llvm-project/pull/114699.diff
1 Files Affected:
- (modified) clang-tools-extra/clangd/Protocol.cpp (+10)
``````````diff
diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp
index c08f80442eaa06..5a303123b5ce84 100644
--- a/clang-tools-extra/clangd/Protocol.cpp
+++ b/clang-tools-extra/clangd/Protocol.cpp
@@ -504,6 +504,16 @@ bool fromJSON(const llvm::json::Value &Params, ClientCapabilities &R,
P.field("offsetEncoding")))
return false;
}
+
+ if (auto *Experimental = O->getObject("experimental")) {
+ if (auto *TextDocument = Experimental->getObject("textDocument")) {
+ if (auto *Completion = TextDocument->getObject("completion")) {
+ if (auto EditsNearCursor = Completion->getBoolean("editsNearCursor"))
+ R.CompletionFixes |= *EditsNearCursor;
+ }
+ }
+ }
+
return true;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/114699
More information about the cfe-commits
mailing list