[clang-tools-extra] [clangd] Implement LSP 3.17 positionEncoding (PR #142903)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 13 01:03:13 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();
----------------
someoneinjd wrote:

I have added a new field `PositionEncodings` in `Protocol.h` and marked `offsetEncoding` as deprecated. Now in `ClangdLSPServer.cpp`, if `offsetEncoding` is detected as being set, a warning message will be sent to the client.

https://github.com/llvm/llvm-project/pull/142903


More information about the cfe-commits mailing list