Skip to content

x/tools/gopls: handle formatting on files that do not parse #31291

@stamblerre

Description

@stamblerre

If we don't check a package's parse errors before formatting, we may encounter a case where we delete code on format.

Repro:

package foo

func _() {
	f(),
	f()
}

To handle this, we check the parse errors before formatting. However, we should confirm that these errors belong to the file in question and lie within the specified range before failing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.SuggestedIssues that may be good for new contributors looking for work to do.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions