#text-document #lsp #language-server #offset #manager #mapping #client

lsp-textdocument

A LSP text documents manager that map of text document

13 releases

0.4.1 Jan 30, 2025
0.4.0 Jul 11, 2024
0.3.2 Oct 22, 2023
0.3.1 Aug 20, 2023
0.1.0 Nov 20, 2022

#38 in Text editors

Download history 685/week @ 2024-10-28 416/week @ 2024-11-04 408/week @ 2024-11-11 602/week @ 2024-11-18 448/week @ 2024-11-25 507/week @ 2024-12-02 528/week @ 2024-12-09 469/week @ 2024-12-16 304/week @ 2024-12-23 428/week @ 2024-12-30 1781/week @ 2025-01-06 1617/week @ 2025-01-13 1665/week @ 2025-01-20 2192/week @ 2025-01-27 3854/week @ 2025-02-03 2790/week @ 2025-02-10

10,752 downloads per month
Used in 4 crates (3 directly)

MIT license

35KB
716 lines

lsp-textdocument

A LSP text documents manager that helps mapping of textual content.

Introduction

You may not be able to manage your text documents comfortably when developing an LSP service. There are two reasons why we develop hard.

  • Always given a URL variable only, so we need to read the contents of the file ourselves.
  • Need map offsets from string index to text dimensional coordinates.

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.

Example usage

Basic usage

use lsp_textdocument::TextDocuments;

fn main() {
    let text_documents = TextDocument::new();
    ...


    let text = text_documents.get_document_content(&url, None);
}

with lsp-server

examples/with_lsp_server.rs

with tower-lsp

Contact us via issues if you require this with tower-lsp

Attention

Dependencies

~1.3–2.2MB
~45K SLoC