Bad autocomplete in comments
I have recently been receiving autocomplete when pressing enter at the end of a sentence in a comment:
-- foo is a number.
foo = 1
If my cursor is at the full stop after "number", and I press enter, then I normally get {-# ANN annotation #-} inserted, or some random Core variable.
It would be good to only provide autocomplete outside of comments imo...
Some clients have the ability to turn this off, e.g. https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-mode.el#L1579
It's a little unclear what we should do, but we should probably indeed turn this off if we're in comments.
Note that there are some legitimate uses for it, e.g. if you're writing Haddock you might want to autocomplete a type name to link to it.
My 2c: I can count on one hand the number of times recently where I have wanted to autocomplete a name in a Haddock like this recently, but autocompleting on sentences at the ends of lines when not desired happens extremely frequently. After being annoyed by this for a couple years, I've started writing long comments in a different editor and pasting them back. I'd much rather this be turned off if we are in comments, and configure a keystroke to offer completions if I really want them.
So what we need is something like: do not perform autocompletion in comments after a period (because it is much more likely to be a full stop than a code snippet).
Yeah probably. I am still somewhat confused about why this doesn't seem to work already with the clients that claim to not trigger completion in comments, but I do think just blanket not providing suggestions inside comments would be an improvement.