Skip to content

Fix redundant import actions for names starting with _ #2483

New issue

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

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

Already on GitHub? # to your account

Merged
merged 4 commits into from
Dec 14, 2021

Conversation

Ailrun
Copy link
Member

@Ailrun Ailrun commented Dec 13, 2021

Names starting with _ is often used, for example, with lens among many others. However, the current redundant import action does not remove those even when they are redundant.

For instance,

import Control.Lens ((^.), _1, _2)

myVal = (1, 2) ^. _1

Here, _2 is redundant, but GHCIDE does not give any actions. Adding one more redundant import like

import Control.Lens ((^.), _1, _2, use)

gives the action, but the action removes only use, not _2.

This PR resolves this issue.

Copy link
Collaborator

@pepeiborra pepeiborra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for the fix!

@Ailrun Ailrun added the merge me Label to trigger pull request merge label Dec 13, 2021
@Ailrun Ailrun force-pushed the fix-redundant-import branch from 9156b6c to ebd0912 Compare December 13, 2021 21:41
@Ailrun Ailrun merged commit bb73e32 into master Dec 14, 2021
@Ailrun Ailrun deleted the fix-redundant-import branch December 14, 2021 02:32
drsooch added a commit to drsooch/haskell-language-server that referenced this pull request Apr 30, 2022
Instead of using a low-level `is_ident` that only works on ascii
characters. Instead match directly on the '_' character. The original
functionality has been restored (using `isAlpha` instead).

This commit removes the now unneccessary `is_ident` compat layer
drsooch added a commit to drsooch/haskell-language-server that referenced this pull request Apr 30, 2022
Instead of using a low-level `is_ident` that only works on ascii
characters. Instead match directly on the '_' character. The original
functionality has been restored (using `isAlpha` instead).

This commit removes the now unneccessary `is_ident` compat layer
mergify bot added a commit that referenced this pull request May 1, 2022
* Revert partial changes from #2483

Instead of using a low-level `is_ident` that only works on ascii
characters. Instead match directly on the '_' character. The original
functionality has been restored (using `isAlpha` instead).

This commit removes the now unneccessary `is_ident` compat layer

* Add regression test for unicode functions

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
sloorush pushed a commit to sloorush/haskell-language-server that referenced this pull request May 21, 2022
* Revert partial changes from haskell#2483

Instead of using a low-level `is_ident` that only works on ascii
characters. Instead match directly on the '_' character. The original
functionality has been restored (using `isAlpha` instead).

This commit removes the now unneccessary `is_ident` compat layer

* Add regression test for unicode functions

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
hololeap pushed a commit to hololeap/haskell-language-server that referenced this pull request Aug 26, 2022
* Revert partial changes from haskell#2483

Instead of using a low-level `is_ident` that only works on ascii
characters. Instead match directly on the '_' character. The original
functionality has been restored (using `isAlpha` instead).

This commit removes the now unneccessary `is_ident` compat layer

* Add regression test for unicode functions

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
merge me Label to trigger pull request merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants