protocompile
protocompile copied to clipboard
Feature Request: LSP Position to SourcePos helper function
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.
Just a note that a reverse of this operation on a similar type (ast.NodeInfo -> protocol.Range) is used by the LSP implementation.