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

lsp-textdocument

A LSP text documents manager that map of text document

12 releases

0.4.0 Jul 11, 2024
0.3.2 Oct 22, 2023
0.3.1 Aug 20, 2023
0.2.6 Aug 8, 2023
0.1.0 Nov 20, 2022

#59 in Text editors

Download history 688/week @ 2024-07-26 511/week @ 2024-08-02 559/week @ 2024-08-09 594/week @ 2024-08-16 585/week @ 2024-08-23 646/week @ 2024-08-30 551/week @ 2024-09-06 566/week @ 2024-09-13 588/week @ 2024-09-20 696/week @ 2024-09-27 610/week @ 2024-10-04 823/week @ 2024-10-11 706/week @ 2024-10-18 645/week @ 2024-10-25 493/week @ 2024-11-01 374/week @ 2024-11-08

2,319 downloads per month
Used in 2 crates

MIT license

34KB
690 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.3MB
~47K SLoC