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

fix new import position #2981

Merged
merged 9 commits into from Jun 27, 2022
Merged

fix new import position #2981

merged 9 commits into from Jun 27, 2022

Conversation

kokobd
Copy link
Collaborator

@kokobd kokobd commented Jun 22, 2022

This will close #2414

Progress:

  • ghc-9.2
  • prior to ghc-9.2 (old annotation API)

@kokobd kokobd marked this pull request as draft June 23, 2022 08:54
@kokobd
Copy link
Collaborator Author

kokobd commented Jun 23, 2022

it's not ready, I found another bad case

@kokobd kokobd marked this pull request as ready for review June 23, 2022 12:29
@kokobd
Copy link
Collaborator Author

kokobd commented Jun 23, 2022

CI is green now

@kokobd kokobd requested review from wz1000 and michaelpj June 24, 2022 00:07
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.

There's some other place that inserts imports too, right? Is it using the same code now?

@kokobd
Copy link
Collaborator Author

kokobd commented Jun 24, 2022

There's some other place that inserts imports too, right?

I'm only aware of code action and completion. Both of them use the same function to determine the insert position. I'll try to look for more, but if anyone knows, please comment here.

@michaelpj
Copy link
Collaborator

The various plugins that do stuff with imports, maybe?

@pepeiborra
Copy link
Collaborator

Previously we fixed the functions that extend import lists to use ghc-exactprint, and this PR fixes the functions that insert new import declarations. So It think we are good now

@kokobd
Copy link
Collaborator Author

kokobd commented Jun 25, 2022

I searched for [a-zA-Z0-9]import and import[a-zA-Z0-9] case-insensitively in the project. Some plugins have import-related stuff, but it seems that they are not adding new imports.

@kokobd kokobd requested a review from michaelpj June 26, 2022 00:03
@kokobd
Copy link
Collaborator Author

kokobd commented Jun 26, 2022

Maybe this is ok to be merged?

@michaelpj michaelpj added the merge me Label to trigger pull request merge label Jun 26, 2022
@kokobd
Copy link
Collaborator Author

kokobd commented Jun 27, 2022

@Mergifyio refresh

@mergify
Copy link
Contributor

mergify bot commented Jun 27, 2022

refresh

✅ Pull request refreshed

@mergify mergify bot merged commit 0b8c793 into haskell:master Jun 27, 2022
hololeap pushed a commit to hololeap/haskell-language-server that referenced this pull request Aug 26, 2022
* haskell#2414 fix new import position

* fix auto import for ghc version < 9.2

* re-fix it for ghc-9.2

* handle comments

* add more comments

* reword comments of findPositionNoImports

Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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.

Minor "import action" formatting bug
3 participants