-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
Remove undefined exports suggestions #1193
Conversation
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.
This is very nice work, solidly tested. Thanks!
@@ -100,7 +101,8 @@ codeAction lsp state (TextDocumentIdentifier uri) _range CodeActionContext{_diag | |||
[ CACodeAction $ CodeAction title (Just CodeActionQuickFix) (Just $ List [x]) (Just edit) Nothing | |||
| x <- xs, (title, tedit) <- suggestAction exportsMap ideOptions parsedModule text x | |||
, let edit = WorkspaceEdit (Just $ Map.singleton uri $ List tedit) Nothing | |||
] <> caRemoveRedundantImports parsedModule text diag xs uri | |||
] <> caRemoveRedundantExports parsedModule text diag xs uri |
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.
Would you mind if I request to use a different name?
I mean, those undefined exports are not something "redundant", and it's more like, just as your title, "undefined", right?
I found this name is a bit confusing and may conflict with the real "removing redundant export" feature in the future.
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.
Indeed the name should change. It covers a bit more cases than undefined
, like dodgy-exports. Maybe wrongExports or invalidExports?
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.
Yeah, they would be better.
I think this pr will close #156 |
hlint is failing:
|
It needs a rebase too |
906cae7
to
b141ffb
Compare
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.
I think it's good to go? @pepeiborra
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.
Looks good to me
This pr adds suggestions for removing elements of the export list causing an error or a warning. It also adds a special suggestion to remove all such elements at once:
It looked a lot like the remove imports suggestions, so I tried to use things from there, but this wasn't always possible.