| Crates.io | lsp-textdocument |
| lib.rs | lsp-textdocument |
| version | 0.5.0 |
| created_at | 2022-11-20 02:53:05.911734+00 |
| updated_at | 2026-01-08 05:41:27.064354+00 |
| description | A LSP text documents manager that map of text document. |
| homepage | https://github.com/GiveMe-A-Name/lsp-textdocument |
| repository | https://github.com/GiveMe-A-Name/lsp-textdocument |
| max_upload_size | |
| id | 718873 |
| size | 54,736 |
lsp-textdocumentA LSP text documents manager that helps mapping of textual content.
You may not be able to manage your text documents comfortably when developing an LSP service. There are two reasons why we develop hard.
By listening to the notification from the LSP client, lsp-textdocument can help you automatically manage text documents.
This crate is base on vscode-languageserver-textdocument.
use lsp_textdocument::TextDocuments;
use lsp_types::Uri;
fn main() {
// Defaults to UTF-16 (per LSP backward compatibility)
let mut text_documents = TextDocuments::new();
// Or explicitly choose the negotiated encoding
// use lsp_types::PositionEncodingKind;
// let mut text_documents = TextDocuments::with_encoding(PositionEncodingKind::UTF8);
let uri: Uri = "file:///example.txt".parse().unwrap();
let text = text_documents.get_document_content(&uri, None);
println!("{:?}", text);
}
lsp-servertower-lspContact us via issues if you require this with tower-lsp
TextDocuments::with_encoding or FullTextDocument::new_with_encoding to opt into UTF-8/UTF-32.