haskell-language-server icon indicating copy to clipboard operation
haskell-language-server copied to clipboard

Tab completion inserts import that creates an import cycle

Open andreasabel opened this issue 1 month ago • 2 comments

I have experienced that tab-completion to generate code will sometimes

  • add imports that are not actually used in the final version of the tab-completed code (I don't know how this works, it seems like tab-completion makes sometimes intermediary versions that it corrects later, maybe on a second tab press)
  • these imports may create import cycles, effectively shutting down the whole HLS interaction (as this is a fatal error)

I just experienced this in the Agda code base (which has 450 modules). It is probably not easy to generate a small reproducer, but maybe some finds one or I can try later.

andreasabel avatar Nov 27 '25 16:11 andreasabel

Hi, thank you for the bug report, I can confirm, that this rather annoying bug hits me from time to time as well, and is a foot gun we definitely need to remove.

It is not with every symbol, though, right? Iirc, it seems to be happening with NoFieldSelector completions in particular.

fendor avatar Nov 28 '25 10:11 fendor

Dunno, have not had a closer look, but I find quote often random imports that make no sense added to my import collection without confirmation.

andreasabel avatar Nov 30 '25 16:11 andreasabel