Documentation
¶
Index ¶
- Variables
- func BytePositionToUTF16Position(src string, pos lsp.Position) lsp.Position
- func GetLspPosition(files map[lsp.DocumentURI]string) (formattedFiles map[lsp.DocumentURI]string, path lsp.DocumentURI, ...)
- func GetUTF16LspPosition(files map[lsp.DocumentURI]string) (formattedFiles map[lsp.DocumentURI]string, path lsp.DocumentURI, ...)
- func IndexToPosition(file string, index int) lsp.Position
- func UTF16PositionToBytePosition(src string, pos lsp.Position) lsp.Position
- type PositionConverter
Constants ¶
This section is empty.
Variables ¶
var ErrNoPosition = errors.New("no position")
Functions ¶
func BytePositionToUTF16Position ¶ added in v0.8.0
BytePositionToUTF16Position converts a byte-column position into the UTF-16-column position an LSP client expects.
func GetLspPosition ¶
func GetLspPosition(files map[lsp.DocumentURI]string) (formattedFiles map[lsp.DocumentURI]string, path lsp.DocumentURI, position lsp.Position, err error)
func GetUTF16LspPosition ¶ added in v0.8.0
func GetUTF16LspPosition(files map[lsp.DocumentURI]string) (formattedFiles map[lsp.DocumentURI]string, path lsp.DocumentURI, position lsp.Position, err error)
GetUTF16LspPosition is GetLspPosition with the cursor Character counted in UTF-16 code units, i.e. what an LSP client would send.
Types ¶
type PositionConverter ¶ added in v0.8.0
type PositionConverter struct {
// contains filtered or unexported fields
}
PositionConverter converts positions between byte columns, which the source package works with, and UTF-16 code unit columns, which LSP clients use by default. It splits src once so that converting many positions of the same file stays linear.
func NewPositionConverter ¶ added in v0.8.0
func NewPositionConverter(src string) PositionConverter
func (PositionConverter) FromUTF16 ¶ added in v0.8.0
func (c PositionConverter) FromUTF16(pos lsp.Position) lsp.Position
FromUTF16 converts a UTF-16-column position. A column past the end of its line is clamped to the line end; a line outside src is returned unchanged.
func (PositionConverter) RangeToUTF16 ¶ added in v0.8.0
func (c PositionConverter) RangeToUTF16(r lsp.Range) lsp.Range