Skip to content

Commit a30b996

Browse files
HighCommander4PhilippRados
authored andcommitted
[clangd] Check for editsNearCursor client capability under experimental 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
1 parent a9302e4 commit a30b996

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

clang-tools-extra/clangd/Protocol.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,16 @@ bool fromJSON(const llvm::json::Value &Params, ClientCapabilities &R,
504504
P.field("offsetEncoding")))
505505
return false;
506506
}
507+
508+
if (auto *Experimental = O->getObject("experimental")) {
509+
if (auto *TextDocument = Experimental->getObject("textDocument")) {
510+
if (auto *Completion = TextDocument->getObject("completion")) {
511+
if (auto EditsNearCursor = Completion->getBoolean("editsNearCursor"))
512+
R.CompletionFixes |= *EditsNearCursor;
513+
}
514+
}
515+
}
516+
507517
return true;
508518
}
509519

0 commit comments

Comments
 (0)