Skip to content
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

Add code action for hiding imports #156

Closed
fendor opened this issue Jun 12, 2020 · 2 comments · Fixed by #1193 or #1322
Closed

Add code action for hiding imports #156

fendor opened this issue Jun 12, 2020 · 2 comments · Fixed by #1193 or #1322
Labels
type: enhancement New feature or request

Comments

@fendor
Copy link
Collaborator

fendor commented Jun 12, 2020

Initially taken from: haskell/haskell-ide-engine#1191

It would be nice if there was a code action for hiding imports which are unused and being shadowed by local declarations.

This is complicated because it requires some detailed information on the provenance of these names in order to hide them (for example if they are record fields).
An example:

Given the following warning:

triangle/Main.hs:83:26: warning: [-Wname-shadowing]
    This binding for ‘window’ shadows the existing bindings
      imported from ‘Graphics.Vulkan’ at triangle/Main.hs:(29,1)-(45,59)
      (and originally defined in ‘Graphics.Vulkan.Extensions.VK_NN_vi_surface’)
      imported from ‘Graphics.Vulkan’ at triangle/Main.hs:(29,1)-(45,59)
      (and originally defined in ‘Graphics.Vulkan.Extensions.VK_KHR_xlib_surface’)
      imported from ‘Graphics.Vulkan’ at triangle/Main.hs:(29,1)-(45,59)
      (and originally defined in ‘Graphics.Vulkan.Extensions.VK_KHR_xcb_surface’)
      imported from ‘Graphics.Vulkan’ at triangle/Main.hs:(29,1)-(45,59)
      (and originally defined in ‘Graphics.Vulkan.Extensions.VK_KHR_android_surface’)

As a first step, we can try to implement a mechanism to hide a symbol that is name shadowing and can improve this with some time!

There are two different implementation paths ahead:

@pepeiborra
Copy link
Collaborator

I think this was closed by mistake, #1193 seems unrelated

@pepeiborra pepeiborra reopened this Jan 23, 2021
@alanz
Copy link
Collaborator

alanz commented Feb 5, 2021

HLS at 0fd73f8 gives really good code actions for resolving ambiguous functions

Screenshot 2021-02-05 at 11 01 22

It would be great to see the same machinery modified for name shadowing cases. At the very least to hide the imported clashing name if it is not actually used in the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
4 participants