Skip to content

Applying a code action to a _ hole produces too many suggestions #4198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mitchellwrosen opened this issue Apr 30, 2024 · 2 comments · Fixed by #4288
Closed

Applying a code action to a _ hole produces too many suggestions #4198

mitchellwrosen opened this issue Apr 30, 2024 · 2 comments · Fixed by #4288
Labels
Hackathon This issue is suitable for hackathon sessions type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@mitchellwrosen
Copy link

I'm often using code actions to import out-of-scope identifiers. But sometimes I accidentally run a code action on a line that contains both an out-of-scope identifier and an underscore, such as:

TwoWay.twoWay (zipDefnsWith (alignWith _) undefined) conflicts
                             ^^^^^^^^^
                                this is out of scope, and I want HLS to suggest
                                `import Data.Semialign (alignWith)` with a code action.

In this case, the _ on the same line will cause 1800 (!) suggestions that look like

1: replace _ with foo
2: replace _ with bar
...

for (I guess?) every single identifier in scope.

@michaelpj michaelpj added type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. Hackathon This issue is suitable for hackathon sessions and removed status: needs triage type: enhancement New feature or request labels May 1, 2024
@michaelpj
Copy link
Collaborator

Many things weird here:

  • GHC shouldn't compute all this stuff
  • We should limit the number of things also

Also somewhat unclear why this is happening at all?

@akshaymankar
Copy link
Contributor

I'm looking into this during Zurihac 2024.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hackathon This issue is suitable for hackathon sessions type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
Development

Successfully merging a pull request may close this issue.

3 participants