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

Support resolve in type lenses #3743

Merged
merged 8 commits into from
Aug 10, 2023

Conversation

joyfulmantis
Copy link
Collaborator

I was hoping to merge all signature related stuff into one plugin, as it gives refactoring flexibility in changing rules and some functions. Unfortunately, the plugin that currently includes those code actions is hls-refactor, which is very creatively engineered. Hence, I had to give up on that effort.
I have so far come across two bugs in type-lenses HEAD, one where long signatures are formatted incorrectly, which is fixed here by putting the signature into a single line. The other, where local bindings mostly don't work is still unresolved. I hope to solve that and fix it here before merging, but currently still unsure what's causing it.

ghcide/src/Development/IDE/Plugin/TypeLenses.hs Outdated Show resolved Hide resolved
ghcide/src/Development/IDE/Plugin/TypeLenses.hs Outdated Show resolved Hide resolved
ghcide/src/Development/IDE/Plugin/TypeLenses.hs Outdated Show resolved Hide resolved
ghcide/src/Development/IDE/Plugin/TypeLenses.hs Outdated Show resolved Hide resolved
ghcide/src/Development/IDE/Plugin/TypeLenses.hs Outdated Show resolved Hide resolved
ghcide/src/Development/IDE/Plugin/TypeLenses.hs Outdated Show resolved Hide resolved
ghcide/src/Development/IDE/Plugin/TypeLenses.hs Outdated Show resolved Hide resolved
ghcide/src/Development/IDE/Plugin/TypeLenses.hs Outdated Show resolved Hide resolved
ghcide/src/Development/IDE/Plugin/TypeLenses.hs Outdated Show resolved Hide resolved
@michaelpj
Copy link
Collaborator

Not sure why the CI isn't running. Maybe fix the conflicts and push again.

Copy link
Collaborator

@michaelpj michaelpj left a comment

Choose a reason for hiding this comment

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

Looking good, just a couple nits

ghcide/src/Development/IDE/Plugin/TypeLenses.hs Outdated Show resolved Hide resolved
=~ ("(Top-level binding|Pattern synonym) with no type signature" :: T.Text)
, Just (GlobalBindingTypeSigsResult sigs) <- mGblSigs
, Just sig <- find (\x -> sameThing (gbSrcSpan x) _range) sigs
-- If a PositionMapping is supplied, this function will call
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I made a comment about this and it got lost - why can't it be the caller's responsibility to map the Range?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I marked your previous comment as resolved, because I did move the range position mapping stuff to the caller. However the position mapping is still sent to the function that generates lenses from the global signature

@michaelpj michaelpj merged commit 099efbf into haskell:master Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants