haskell / haskell-language-server

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

Prevent intellisense suggestions and auto imports when writing comments #2292

Open alirezaghey opened 3 years ago

alirezaghey commented 3 years ago

Right now, when you refer to a library in comments, Data.Either for instance, the extension auto suggests importing that library and imports it automatically if you press enter. It also kicks into action if you start your comment with >>>.

IMO, it would be better if the extension would avoid automatic activity when we are writing comments and only do so on specific request (by pressing ctrl+space for example).

jneira commented 3 years ago

Transferred to haskell-language-server as it the source of suggestions (quick fixes/code actions)

michaelpj commented 2 years ago

I think this is the client's problem. At least for emacs, whether or not to ask for completions in comments is a setting in the client.

Also, you might want completions in comments, e.g. for linking to types in Haddock comments.

michaelpj commented 4 months ago

TBH, this continues to be pretty annoying and people report it in multiple clients. So we probably should try and avoid it, although I'm not sure how.

Anrock commented 4 months ago

LSP server should be able to determine if cursor is inside comment block or comments are already stripped from source after parsing? If it's able then I believe autocompletion only makes sense inside @-code blocks inside comments.

fendor commented 4 months ago

Presumably, we are not checking correctly in getCContext, whether the cursor is part of an annotation? Might be a nice project for the next hackathon.