-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clangd] Check for other clangd extension capabilities under 'experimental' #116531
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
@llvm/pr-subscribers-clang-tools-extra @llvm/pr-subscribers-clangd Author: Nathan Ridge (HighCommander4) ChangesThis is a follow-up to PR114699, with the same motivation: to support clients which only support adding custom (language-specific or server-specific) capabilities under 'experimental'. Full diff: https://github.com/llvm/llvm-project/pull/116531.diff 2 Files Affected:
diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp
index 761f96846d4538..2b26e16598821c 100644
--- a/clang-tools-extra/clangd/Protocol.cpp
+++ b/clang-tools-extra/clangd/Protocol.cpp
@@ -511,6 +511,28 @@ bool fromJSON(const llvm::json::Value &Params, ClientCapabilities &R,
if (auto EditsNearCursor = Completion->getBoolean("editsNearCursor"))
R.CompletionFixes |= *EditsNearCursor;
}
+ if (auto *References = TextDocument->getObject("references")) {
+ if (auto ContainerSupport = References->getBoolean("container")) {
+ R.ReferenceContainer |= *ContainerSupport;
+ }
+ }
+ if (auto *Diagnostics = TextDocument->getObject("publishDiagnostics")) {
+ if (auto CodeActions = Diagnostics->getBoolean("codeActionsInline")) {
+ R.DiagnosticFixes |= *CodeActions;
+ }
+ }
+ }
+ if (auto *Window = Experimental->getObject("window")) {
+ if (auto Implicit =
+ Window->getBoolean("implicitWorkDoneProgressCreate")) {
+ R.ImplicitProgressCreation |= *Implicit;
+ }
+ }
+ if (auto *OffsetEncoding = Experimental->get("offsetEncoding")) {
+ R.offsetEncoding.emplace();
+ if (!fromJSON(*OffsetEncoding, *R.offsetEncoding,
+ P.field("offsetEncoding")))
+ return false;
}
}
diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h
index 5b28095758198d..c7ef1a13e6e39e 100644
--- a/clang-tools-extra/clangd/Protocol.h
+++ b/clang-tools-extra/clangd/Protocol.h
@@ -452,6 +452,7 @@ struct ClientCapabilities {
std::optional<SymbolKindBitset> WorkspaceSymbolKinds;
/// Whether the client accepts diagnostics with codeActions attached inline.
+ /// This is a clangd extension.
/// textDocument.publishDiagnostics.codeActionsInline.
bool DiagnosticFixes = false;
@@ -475,6 +476,7 @@ struct ClientCapabilities {
/// Client supports displaying a container string for results of
/// textDocument/reference (clangd extension)
+ /// textDocument.references.container
bool ReferenceContainer = false;
/// Client supports hierarchical document symbols.
@@ -563,6 +565,7 @@ struct ClientCapabilities {
/// Whether the client supports the textDocument/inactiveRegions
/// notification. This is a clangd extension.
+ /// textDocument.inactiveRegionsCapabilities.inactiveRegions
bool InactiveRegions = false;
};
bool fromJSON(const llvm::json::Value &, ClientCapabilities &,
|
…ental' This is a follow-up to PR114699, with the same motivation: to support clients which only support adding custom (language-specific or server-specific) capabilities under 'experimental'.
bdc4d0a
to
a01e4d2
Compare
I forgot |
Closes #13089 Here we use `experimental` to advertise our support for `inactiveRegions`. Note that clangd does not currently have a stable release that reads the `experimental` object (PR llvm/llvm-project#116531), this can be tested with one of clangd's recent "unstable snapshots" in their [releases](https://github.com/clangd/clangd/releases). Release Notes: - Added support for clangd's `inactiveRegions` extension.  --------- Co-authored-by: Peter Tripp <[email protected]> Co-authored-by: Kirill Bulatov <[email protected]>
This is a follow-up to PR114699, with the same motivation: to support clients which only support adding custom (language-specific or server-specific) capabilities under 'experimental'.