bufbuild/protocompile

Feature Request: LSP Position to SourcePos helper function

Alfus opened this issue · 0 comments

LSP provides (0-based) Line and Character for a position:
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position
while a ast.SourcePos provides (1-based) Line, Col and (0-based) offset.

A helper function to take a Line and Col, and convert it back to an offset would be very helpful to an implementation that converts from a LSP Position to a SourcePos.