[llvm] [SupportLSP] Add DidSaveTextDocumentParams (PR #172637)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 17 03:48:20 PST 2025


https://github.com/Bertik23 created https://github.com/llvm/llvm-project/pull/172637

Add DidSaveTextDocumentParams

Direct copy from clangd.

>From 72df0da7d1f921b9596eb5b2b466fcdd73d9ef56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Albert=20Havli=C4=8Dek?= <ahavlicek at azul.com>
Date: Wed, 17 Dec 2025 11:46:00 +0000
Subject: [PATCH] [SupportLSP] Add DidSaveTextDocumentParams

---
 llvm/include/llvm/Support/LSP/Protocol.h | 11 +++++++++++
 llvm/lib/Support/LSP/Protocol.cpp        | 10 ++++++++++
 2 files changed, 21 insertions(+)

diff --git a/llvm/include/llvm/Support/LSP/Protocol.h b/llvm/include/llvm/Support/LSP/Protocol.h
index 30d68bad6691a..8f05c6f812d01 100644
--- a/llvm/include/llvm/Support/LSP/Protocol.h
+++ b/llvm/include/llvm/Support/LSP/Protocol.h
@@ -494,6 +494,17 @@ LLVM_ABI_FOR_TEST bool fromJSON(const llvm::json::Value &value,
                                 DidCloseTextDocumentParams &result,
                                 llvm::json::Path path);
 
+//===----------------------------------------------------------------------===//
+// DidSaveTextDocumentParams
+//===----------------------------------------------------------------------===//
+
+struct DidSaveTextDocumentParams {
+  /// The document that was saved.
+  TextDocumentIdentifier textDocument;
+};
+bool fromJSON(const llvm::json::Value &, DidSaveTextDocumentParams &,
+              llvm::json::Path);
+
 //===----------------------------------------------------------------------===//
 // DidChangeTextDocumentParams
 //===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Support/LSP/Protocol.cpp b/llvm/lib/Support/LSP/Protocol.cpp
index c2957bdc0dacb..5c2379431e900 100644
--- a/llvm/lib/Support/LSP/Protocol.cpp
+++ b/llvm/lib/Support/LSP/Protocol.cpp
@@ -502,6 +502,16 @@ bool llvm::lsp::fromJSON(const llvm::json::Value &Value,
   return O && O.map("textDocument", Result.textDocument);
 }
 
+//===----------------------------------------------------------------------===//
+// DidSaveTextDocumentParams
+//===----------------------------------------------------------------------===//
+
+bool llvm::lsp::fromJSON(const llvm::json::Value &Params,
+                         DidSaveTextDocumentParams &R, llvm::json::Path P) {
+  llvm::json::ObjectMapper O(Params, P);
+  return O && O.map("textDocument", R.textDocument);
+}
+
 //===----------------------------------------------------------------------===//
 // DidChangeTextDocumentParams
 //===----------------------------------------------------------------------===//



More information about the llvm-commits mailing list