haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.65k stars 354 forks source link

Bad autocomplete in comments #3370

Open santiweight opened 1 year ago

santiweight commented 1 year ago

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...

michaelpj commented 1 year ago

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.