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 <zeratul...@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; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits