atom / autocomplete-plus

View and insert possible completions in the editor while typing
MIT License
959 stars 263 forks source link

Using Enter two times for two autocomplete suggestions in a row adds new line in stylesheet files on second enter #981

Open tomanistor opened 6 years ago

tomanistor commented 6 years ago

Prerequisites

Description

When editing stylesheet files (.scss in particular) and using enter to autocomplete two times in a row (to autocomplete a CSS property and autocomplete its value), the second enter adds a new line rather than autocompleting the value.

Steps to Reproduce

  1. With default plugin settings, begin writing a CSS property
  2. Use enter key to autocomplete first suggested property and see that it is autocompleted
  3. Use enter key to autocomplete first suggested property value and see that a new line is added

example

Expected behavior: The use of the enter key should add the suggested autocomplete selection

Actual behavior: The use of the enter key works initially, but a consecutive use on a new autocomplete suggested adds a new line

Reproduces how often: 90% in normal mode, 10% in safe mode

Versions

Atom    : 1.28.1
Electron: 2.0.4
Chrome  : 61.0.3163.100
Node    : 8.9.3

apm  1.19.0
npm  3.10.10
node 6.9.5 x64
atom 1.28.1
python 2.7.15
git 2.15.0

Mac OS High Sierra 10.13.5

Additional Information

Not using Emmet. I almost exclusively write SCSS files, but I have tested in CSS files. Only happened 10% of the time in safe mode. I believe it may be happening most frequently with SCSS files with nested and non-nested elements.

dannyuk1982 commented 5 years ago

I get this too - drives me nuts. Any fix or workaround available?

Additional: it also does this is you start typing something, so in the example here if you started typing abs it would still just put in a new line and not auto complete.

rsese commented 5 years ago

Thanks for the report - I was unable to reproduce on macOS 10.12.6 with Atom 1.32.1 in safe mode (tried it ~10 times in a row).

I believe it may be happening most frequently with SCSS files with nested and non-nested elements.

@tomanistor: can you share an minimal example file that I can test with?

nicolashmln commented 5 years ago

I have the same problem on SCSS files with Atom 1.32.2 and macOS 10.14.1. I can reproduce the same way it's described in the first message.

rsese commented 5 years ago

@nicolashmln - do you also see the behavior much less in safe mode as described above? And does it happen with any SCSS files?

nicolashmln commented 5 years ago

@rsese In normal mode it happens on every SCSS files. I can't reproduce in safe mode on the same SCSS files. Should it be an other plugin interfering?

rsese commented 5 years ago

@nicolashmln - yes if there's no problem in safe mode, then that likely means a community package or possibly something in your init script is causing the issue:

http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode

You can disable each community package one by one to try and pinpoint which is causing the problem for you.

dannyuk1982 commented 5 years ago

I've just turned off all Community Packages and re-enabled each one. Turns out that busy-signal was causing this for me, I have turned it off and it's no longer showing this behaviour. No idea what that package did anyway TBH!

nicolashmln commented 5 years ago

Same for me, after disabling busy-signal I don't have this behaviour anymore. Thanks @dannyuk1982 !

Aerijo commented 5 years ago

@dannyuk1982 I believe busy-signal provides a progress indicator in the status bar for other packages to use.

No idea why it's doing that though. You might want to raise an issue on it's repo

dannyuk1982 commented 5 years ago

Have done!

Arcanemagus commented 5 years ago

I can reproduce this in Safe Mode using Atom v1.34.0-nightly9, so this has nothing to do with a community package. In fact it's hard not to reproduce this, as it happens to me ~90% of the time: 2018-11-25_14-46-14

bergeg commented 4 years ago

idk if its gonna help somehow

2020-08-20-16-41-20

sometimes "autocomplete-active" class isnt added to "atom-text-editor" after first enter press, so editor uses editor:newline instead of core:confirm

natezander commented 3 years ago

I've been having this same issue for years and is my only complaint about Atom!

I've tried editing the keymap to resolve this to no avail. What's most confusing is if I go back up to the css property a second time, choose the value with the keyboard and hit enter, the behavior is as expected (confirm's selection, not new line created)

Has anyone figured out the correct keymap entry to resolve this?

https://user-images.githubusercontent.com/5290498/127535837-01f0d2a9-f843-4ef4-ae57-823ee5dcd134.mov

nervewax commented 2 years ago

It looks like @bergeg is right, the class is being removed too soon, or isn't being added again.

All the logic happens inside https://github.com/atom/autocomplete-plus/blob/master/lib/suggestion-list.js, it's hard to debug but someone might be able to figure this one out.

This issue was hard to find via google, so hopefully referencing these similar closed issues will get more people here who are looking for it:

supersonic1999 commented 2 years ago

Getting this issue myself, tried in safemode also and still happens. Found and fixed. see below

FarrisFahad commented 1 year ago

Did anyone find a solution for this?