llvm-project
llvm-project copied to clipboard
[SupportLSP] Add DidSaveTextDocumentParams
Add DidSaveTextDocumentParams
Direct copy from clangd.
@llvm/pr-subscribers-llvm-support
Author: Bertik23 (Bertik23)
Changes
Add DidSaveTextDocumentParams
Direct copy from clangd.
Full diff: https://github.com/llvm/llvm-project/pull/172637.diff
2 Files Affected:
- (modified) llvm/include/llvm/Support/LSP/Protocol.h (+11)
- (modified) llvm/lib/Support/LSP/Protocol.cpp (+10)
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
//===----------------------------------------------------------------------===//
Hi @kadircet you reviewed the commit into clangd, that introduced this change. Could you please take a look at this?