#text-document #lsp #offset #manager #coordinates #index #string

lsp-textdocument

A LSP text documents manager that map of text document

11 releases

0.3.2 Oct 22, 2023
0.3.1 Aug 20, 2023
0.2.6 Aug 8, 2023
0.2.5 Apr 13, 2023
0.1.0 Nov 20, 2022

#436 in Text processing

Download history 188/week @ 2023-12-15 26/week @ 2023-12-22 54/week @ 2023-12-29 44/week @ 2024-01-05 82/week @ 2024-01-12 87/week @ 2024-01-19 154/week @ 2024-01-26 116/week @ 2024-02-02 257/week @ 2024-02-09 90/week @ 2024-02-16 133/week @ 2024-02-23 230/week @ 2024-03-01 198/week @ 2024-03-08 185/week @ 2024-03-15 91/week @ 2024-03-22 81/week @ 2024-03-29

583 downloads per month
Used in html-languageservice

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

~2.4–3.5MB
~100K SLoC