Skip to content

feature(lsp): add text document position conversions - #1818

Open
rgrinberg wants to merge 1 commit into
masterfrom
push-uqplxlxnnlln
Open

feature(lsp): add text document position conversions#1818
rgrinberg wants to merge 1 commit into
masterfrom
push-uqplxlxnnlln

Conversation

@rgrinberg

Copy link
Copy Markdown
Member

Add encoding-aware conversions between LSP positions/ranges and UTF-8 byte offsets without exposing Text_document's zipper. The existing absolute_position and absolute_range names remain as compatibility aliases.

Use the new API to remove the byte-offset/lexer-position round trip from the unused-code-action lookup, and cover both directions with UTF-8, UTF-16, and model-based editing tests.

Fixes #1090.

Add bidirectional conversion between UTF-8 byte offsets and negotiated LSP positions to String_zipper and Text_document. Property-test offset and range round trips over edits and use the API in source-searching code instead of ad hoc Merlin conversions.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
@rgrinberg
rgrinberg force-pushed the push-uqplxlxnnlln branch from 01d64ef to f8c426a Compare July 31, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text_document.offset and Text_document.offsets

1 participant