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

Keep stale lenses for module name #3570

Merged
merged 3 commits into from
Apr 26, 2023
Merged

Conversation

July541
Copy link
Collaborator

@July541 July541 commented Apr 22, 2023

Fix #1769

L (locA -> (RealSrcSpan l _)) m <- MaybeT . pure . hsmodName . unLoc $ pm_parsed_source pm
pure (realSrcSpanToRange l, T.pack $ moduleNameString m)
let range = realSrcSpanToRange l
let range' = fromMaybe range (toCurrentRange mp range)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems wrong, shouldn't we fail or give up somehow if we can't map the range to the current thing, not use the probably-wrong range we have?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Turns out I can't have a counterexample that toCurrentRange can fail, keep it unless we know how it fails.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems risky to me 🤷 Why does it return a Maybe if it can't happen? And if it does happen we'll just silently do the wrong thing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, it makes sense, I'll let them be failed if toCurrentRange returns Nothing. But I'm still curious about how it fails 😅

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you find out, please add some Haddock! 🙃

@michaelpj michaelpj added the merge me Label to trigger pull request merge label Apr 26, 2023
@mergify mergify bot merged commit cda1325 into haskell:master Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Label to trigger pull request merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Module name codelens suggestion always present (with flickering)
2 participants