tigersoldier / company-lsp

Company completion backend for lsp-mode
GNU General Public License v3.0
251 stars 26 forks source link

Completion messing up newlines #150

Open asmodeus812 opened 2 years ago

asmodeus812 commented 2 years ago

``I have noticed a very weird problem with company (with LSP). When typing something and i get the autocomplete options in the list but i decide to delete a few characters (using backspace) the entire line delimiter (\n) gets deleted for some reason and the line below the one i am editing. What is odd is this is happening only when deleting the member accessor (e.g . or -> in c/c++). The same issue also happens if you start typing a symbol, the suggestions show up, if you start deleting char by char, the list updates, but the moment you delete the last character, instead of leaving just a blank line, it inserts the top most suggestion in the list of suggestions and again deletes the new line char (\n)

Type some_var;
some_var.<box-of-suggestions-pops>
............... more code below .......................................

// (BACKSPACE) the member delimiter the dot (.) from some_var
// code below is now on the same line as where i was editing
some_type............... more code now on the same line .......................................
symbol_name<box-of-suggestions-pops>
............... more code below .......................................

// (BACKSPACE) until left out with just an s
s<box-of-suggestions-updated>
............... more code below .......................................

// (BACKSPACE) the s character
<suggestion-on-the-top-when-s-was-present-is-inserted> ............... more code now on the same line .......................................
asmodeus812 commented 2 years ago

Seems to be caused by enabling setq company-auto-complete t, to disable this behaviour disable it like that `setq company-auto-complete nil). Pasting this for future reference -https://stackoverflow.com/questions/27008259/emacs-company-mode-inserts-completion-on-space-key-pressed