-
-
Notifications
You must be signed in to change notification settings - Fork 397
rewrite import completion with ghc-exactprint #2694
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
Conversation
Both |
If we want to know where to insert the new import declaration, we will have to exact print the whole Then I encountered a problem (at least for ghc 8.10.7. I haven't tested it on ghc 9.2). In hls, the exactprint doesn't preserve lines starting with import
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
Data.Monoid ( Monoid )
class Semigroup a => SomeData a
instance SomeData All If we place the cursor on import
Data.Monoid ( Monoid, All )
class Semigroup a => SomeData a
instance SomeData All I'm wondering if losing the |
I believe ghc-exactprint comes with a round tripping test suite. Have you been able to repro the issue using it? |
@pepeiborra I've tried I'm still investigating and trying to fix it in hls. However as changing fundamental parts like parsing might potentially affect other parts of hls, any related context information is welcome ;) |
I might have identified the root cause of the shebang exact printing issue. Created another draft PR #2725 to fix it seperately. |
@kokobd still around? Would be nice to land this |
Sorry for being absent these days. It has taken me a few months to get rid of my tiresome job. I will probably fix this in the next few days, but less aggressively. Using exact print info to print the whole module incurs too much risk (performance, compatibility, etc.) and a lot of code change. Instead, using exact print information to locate the |
Closing in favor of #2981. |
This will solve #2414.
TODO List:
TextEdit
sent to language clientI will request code review when it's feature complete.