Skip to content

x/tools/gopls: CodeAction(refactor.rewrite.removeUnusedParam) preserves unnecessary expressions #76204

@adonovan

Description

@adonovan

At L131 of PatchSet 1 of https://go.dev/cl/718500, the "Remove unused parameter" code action applied in sequence at the startLine parameters of markdownEscape, font, and printStyled, causes this input:

			for i, line := range text.Lines {
				fmt.Fprintf(&md, " ")
				printStyled(&md, line, i == 0)
			}

to be transformed to this suboptimal output:

			for i, line := range text.Lines {
				fmt.Fprintf(&md, " ")
				var _ bool = i == 0               // yuck
				printStyled(&md, line)
			}

We should investigate why.

Metadata

Metadata

Assignees

No one assigned

    Labels

    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