[clang-tools-extra] [clangd] Check for editsNearCursor client capability under experimental capabilities (PR #114699)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 3 00:44:40 PDT 2024
https://github.com/HighCommander4 created https://github.com/llvm/llvm-project/pull/114699
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
>From 52a5625e0806c2a70b6ca728f9f3e42d88b83021 Mon Sep 17 00:00:00 2001
From: Nathan Ridge <zeratul976 at hotmail.com>
Date: Sun, 3 Nov 2024 02:42:46 -0500
Subject: [PATCH] [clangd] Check for editsNearCursor client capability under
experimental capabilities
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
---
clang-tools-extra/clangd/Protocol.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
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;
}
More information about the cfe-commits
mailing list