Skip to content

Neovim seems to interpret positions incorrectly #127

Closed
@Alloyed

Description

@Alloyed

the LSP spec specifies that positions are (line, character) pairs, where the character describes the offset from the start of the line in UTF-16 code units.

neovim seems to be interpreting them as visual columns instead.
Here are some test cases:

local a
------^
	local b
-------^
b = "😬" local c = nil
-----------------^

a() b() c()

here are the values from my language server (line:character):

a = 0:6
b = 2:7
c = 4:17 (edit: should be 4:15)

test case A is a control.
test case B has a tab character, which is one character that represents 8 columns
test case C has an emoji, which should be counted as two utf 16 code units

EDIT: C seems to be a goof on my part (I sent bytes instead of code units), I'll leave it as an example but neovim has the correct behavior here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions