-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Best-effort support of Qualified Imports in GHC 9.4 #3712
Conversation
…verlappingLinesWithRange`)
It seems that regression #22130 in GHC removes import suggestion for qualified symbols. This cannot be fixed even with our approach, so I decided to concentrate on reviving |
I think this PR is ready for review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you very much, this is a great addition!
Small documentation things, otherwise, gtg.
plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs
Outdated
Show resolved
Hide resolved
plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs
Outdated
Show resolved
Hide resolved
plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs
Outdated
Show resolved
Hide resolved
plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs
Outdated
Show resolved
Hide resolved
@fendor @michaelpj Thank you for your reviews and sorry for my late response! I had been a bit busy this week. I'm starting responding to the reviews from now. |
I think I addressed all the reviews so far. Thank you for your feedbacks! I mark some threads that as resolved with some changes, but please feel free to unresolve threads if you are unsatisfied with changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you very much!
Two small comments
plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs
Outdated
Show resolved
Hide resolved
mapNotInScope :: (T.Text -> T.Text) -> NotInScope -> NotInScope | ||
mapNotInScope f (NotInScopeDataConstructor d) = NotInScopeDataConstructor (f d) | ||
mapNotInScope f (NotInScopeTypeConstructorOrClass d) = NotInScopeTypeConstructorOrClass (f d) | ||
mapNotInScope f (NotInScopeThing d) = NotInScopeThing (f d) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this function used for anything else? If not, we can likely turn it into a local function (e.g. in the where block) and remove the parameter f with the thing it is supposed to do (adding a ".")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I made it local, changed to more speic name qualify
, and made it taking qualifier q
instead of general mapping function f
.
Addressed in e0eb90a.
Co-authored-by: fendor <[email protected]>
Test failure with GHC 9.2 on Win seems like a genuine regression:
It seems rather strange as all other versions of GHC on Win passes tests. |
I presume flaky error, I rerun the failing CI run. |
@fendor Now it seems that all It smees Nix build on ubuntu also failed, but it seems due to the storage shortage. So I suppose everything is OK, right? |
@konn CI and I are happy, but you'll need to rebase the PR 😅 |
As discussed in #3473, we cannot provide
import qualified
feature in GHC 9.4 due to the regression in GHC, at least based on the textual information given by error messages.On the other hand, we can still determine qualified module name from the information of error-range and textual source code.
As I am heavily using
Import Qualified
feature everyday life, so I try to follow this path to tentatively support it in GHC 9.4.Even though there can be some corner cases that the method implemented in this PR cannot handle correctly, but even a partial support of this could be still helpful.
TODOs
(Optional) reviveThis cannot be handled as GHC 9.4 won't give us suggested imports.adding new import item to existing list
along this line