You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There exists perhaps a million reimplementation of the same basic data structures for LSP servers, used both for implementation and testing.
Going from offset to a (line, character)
Going from (line, character) to offset in the document
Getting contents of a line
Finding the (line, character) positions of a given offset range
Cutout text based on a position range
Apply a text edit to given range
etc.
It would be good to provide efficient implementations (may be even special cased for platforms!) of these operations, implemented in terms of the LSP structures like Position and Range, so that LSP authors don't reimplement the wheel unnecessarily.
offset -> (line, character) and vice versa are implemented in cats-parse's LocationMap if you want some inspiration :)
Would you say having a "text document manager" would be in scope? vscode-languageserver-node has one, it makes it easier to read a file's contents without having to listen to change events manually.
There exists perhaps a million reimplementation of the same basic data structures for LSP servers, used both for implementation and testing.
It would be good to provide efficient implementations (may be even special cased for platforms!) of these operations, implemented in terms of the LSP structures like Position and Range, so that LSP authors don't reimplement the wheel unnecessarily.
You can see one such implementation here: https://github.com/artempyanykh/marksman/blob/main/Marksman/Text.fs
The text was updated successfully, but these errors were encountered: