-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clangd] Check for editsNearCursor client capability under experimental capabilities #114699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…al capabilities This is done to support clients which only support adding custom (language-specific or server-specific) capabilities under 'experimental'. Fixes clangd/clangd#2201
@llvm/pr-subscribers-clang-tools-extra @llvm/pr-subscribers-clangd Author: Nathan Ridge (HighCommander4) ChangesThis is done to support clients which only support adding custom (language-specific or server-specific) capabilities under 'experimental'. Fixes clangd/clangd#2201 Full diff: https://github.com/llvm/llvm-project/pull/114699.diff 1 Files Affected:
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;
}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(No action required) – we have other extensions in clangd e.g. references.container
offsetEncoding
. Do we plan to do the same thing for them?
Good question; I was initially thinking of doing it as needed / when someone asks for it. But maybe it would be better to add them all up front, so when a need for another one arises, the support is already in a clangd release. I can do that in a follow-up patch. |
Personally I haven't yet looked if other custom capabilities are relevant for the editor I use (Sublime Text) but I also think it would makes sense to be with all of them (and follow the spec). |
…al capabilities (llvm#114699) This is done to support clients which only support adding custom (language-specific or server-specific) capabilities under 'experimental'. Fixes clangd/clangd#2201
Sent out #116531 for this. |
This is done to support clients which only support adding custom (language-specific or server-specific) capabilities under 'experimental'.
Fixes clangd/clangd#2201