Skip to content

x/tools/gopls: fix handling of end of file in internal/span #41029

Closed
@dandua98

Description

@dandua98

Package span currently treats end of file as start of a new line (https://github.com/golang/tools/blob/c024452afbcdebb4a0fbe1bb0eaea0d2dbff835b/internal/span/token.go#L117), which is inaccurate for files with end of file not being a newline. This affects completion on end of file line and we're currently considering a temporary fix there (https://go-review.googlesource.com/c/tools/+/249706). A better fix should come from span itself and the package should check if a final new line is present before converting end of file to start of new line. Just removing this check breaks diff tests and is not a viable fix currently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.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