Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteOffsetToUTF16 ¶
ByteOffsetToUTF16 converts a byte offset to a UTF-16 code unit offset in a string. This is the inverse of UTF16ToByteOffset and is useful for converting positions from Go's byte-based indexing to LSP's UTF-16 positions.
func ByteOffsetToUTF16Uint32 ¶ added in v0.1.19
ByteOffsetToUTF16Uint32 is like ByteOffsetToUTF16 but returns uint32 for LSP compatibility. Clamps the result to valid uint32 range.
func StringLengthUTF16 ¶
StringLengthUTF16 returns the length of a string in UTF-16 code units. This is useful for calculating ranges and validating positions.
func StringLengthUTF16Uint32 ¶ added in v0.1.19
StringLengthUTF16Uint32 is like StringLengthUTF16 but returns uint32 for LSP compatibility. Clamps the result to valid uint32 range.
func UTF16ToByteOffset ¶
UTF16ToByteOffset converts a UTF-16 code unit offset to a byte offset in a string. LSP positions use UTF-16 code units, but Go strings are UTF-8 byte sequences. This function handles surrogate pairs correctly (characters > U+FFFF count as 2 UTF-16 units).
Types ¶
This section is empty.