summaryrefslogtreecommitdiff
path: root/helix-lsp
diff options
context:
space:
mode:
Diffstat (limited to 'helix-lsp')
-rw-r--r--helix-lsp/src/lib.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs
index e4ab153c..96a45bb9 100644
--- a/helix-lsp/src/lib.rs
+++ b/helix-lsp/src/lib.rs
@@ -182,6 +182,22 @@ pub mod util {
}),
)
}
+
+ /// The result of asking the language server to format the document. This can be turned into a
+ /// `Transaction`, but the advantage of not doing that straight away is that this one is
+ /// `Send` and `Sync`.
+ #[derive(Clone, Debug)]
+ pub struct LspFormatting {
+ pub doc: Rope,
+ pub edits: Vec<lsp::TextEdit>,
+ pub offset_encoding: OffsetEncoding,
+ }
+
+ impl From<LspFormatting> for Transaction {
+ fn from(fmt: LspFormatting) -> Transaction {
+ generate_transaction_from_edits(&fmt.doc, fmt.edits, fmt.offset_encoding)
+ }
+ }
}
#[derive(Debug, PartialEq, Clone)]