Skip to content

x/tools/gopls: incorrect completion ranges for multi-byte character at the end of a document #45883

Open
@mattmassicotte

Description

@mattmassicotte

What version of Go are you using (go version)?

go version go1.16.3 darwin/arm64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOHOSTARCH="arm64"
GOHOSTOS="darwin"

(however, I'm running gopls built for amd64)

What did you do?

Request completions with gopls at the very end of a document which as a last line of:

Note that there is no newline at the end.

What did you expect to see?

I expected to get completions referencing a location of 2 on this line

What did you see instead?

Got back completions with locations of 3

This looks like a potential latent character encoding issue, but because these kinds of things are really tricky to work out, so it could end up being an issue on my end. However, I am consistently getting back what I believe are invalid character ranges when a multi-byte (but still single UTF16) character is at the very end of the document. Figured it was worth a report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions