utils

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DocumentOffset

func DocumentOffset(text []byte, position lsp.Position) int

DocumentOffset is a utility function used to turn an LSP cursor position into an offset from the current file buffer.

func Substring

func Substring(str string, from int, length int) string

Substring will return a substring of given length from a given index. If the from index is bigger than the length of the string, it will return an empty string. If the given length would result in an OOB error, the function will return the substring up to the length of the string. If the from index or the length is a negative value, it will return an empty string. If the length is 0, it will return everything starting from the provided index to the end of the string.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL