[clang-tools-extra] [clangd] Implement LSP 3.17 positionEncoding (PR #142903)
kadir çetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 16 04:01:08 PDT 2025
================
@@ -497,6 +497,12 @@ bool fromJSON(const llvm::json::Value &Params, ClientCapabilities &R,
if (auto Cancel = StaleRequestSupport->getBoolean("cancel"))
R.CancelsStaleRequests = *Cancel;
}
+ if (auto *OffsetEncoding = General->get("positionEncodings")) {
+ R.offsetEncoding.emplace();
+ if (!fromJSON(*OffsetEncoding, *R.offsetEncoding,
+ P.field("general").field("positionEncodings")))
+ return false;
+ }
}
if (auto *OffsetEncoding = O->get("offsetEncoding")) {
R.offsetEncoding.emplace();
----------------
kadircet wrote:
thanks, but I think just a simple log message here is sufficient, and we deliberately don't need more (neither the message shown, nor the new field).
- I don't think we should have 2 representations in the internal C++ representation, to make sure canonicalization happens at a single place and rest of the logic that relies on this option doesn't have visibility into both versions. Though we can call this field `PositionEncodings` now to align with the standard.
- Showing a message to user is too disruptive. It'll pop up on every startup. Moreover the user can't do anything to suppress that, extension author needs to take action.
https://github.com/llvm/llvm-project/pull/142903
More information about the cfe-commits
mailing list