Skip to content

x/tools/gopls: improve FixImports filter for short dangling references #67889

@findleyr

Description

@findleyr

@dominikh reports in slack that gopls' organizeImports is particularly slow when there is a method call on an undefined symbol, often when the symbol is short.

Coincidentally, I was just looking at this logic, and noticed that it would lead to a LOT of additional candidates for short unresolved references. For example a single selector on an undefined 'e' or 's' may require reading a large chunk of the module cache.

This should be straightforward to reproduce, if so, and probably not too hard to fix. Unfortunately, I suspect that the imprecise heuristic probably avoids some edge cases like gopkg.in paths, but even so we can handle those explicitly.

CC @adonovan @pjweinb

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeToolsThis 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

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions