autocomplete-plus icon indicating copy to clipboard operation
autocomplete-plus copied to clipboard

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

Open tomanistor opened this issue 5 years ago • 16 comments

Prerequisites

  • [x] Put an X between the brackets on this line if you have done all of the following:
    • Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
    • Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
    • Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
    • Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
    • Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages

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.

tomanistor avatar Jul 09 '18 18:07 tomanistor

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.

dannyuk1982 avatar Oct 19 '18 11:10 dannyuk1982

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?

rsese avatar Nov 08 '18 21:11 rsese

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.

nicolashmln avatar Nov 16 '18 13:11 nicolashmln

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

rsese avatar Nov 16 '18 19:11 rsese

@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?

nicolashmln avatar Nov 19 '18 12:11 nicolashmln

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

rsese avatar Nov 20 '18 17:11 rsese

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!

dannyuk1982 avatar Nov 21 '18 10:11 dannyuk1982

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

nicolashmln avatar Nov 21 '18 10:11 nicolashmln

@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

Aerijo avatar Nov 21 '18 10:11 Aerijo

Have done!

dannyuk1982 avatar Nov 21 '18 11:11 dannyuk1982

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

Arcanemagus avatar Nov 25 '18 22:11 Arcanemagus

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

bergeg avatar Aug 20 '20 13:08 bergeg

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

natezander avatar Jul 29 '21 17:07 natezander

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:

  • https://github.com/atom/autocomplete-plus/issues/471
  • https://github.com/atom/autocomplete-plus/issues/277
  • https://github.com/atom/autocomplete-plus/issues/86

nervewax avatar Mar 31 '22 12:03 nervewax

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

supersonic1999 avatar Sep 12 '22 11:09 supersonic1999

Did anyone find a solution for this?

FarrisFahad avatar Nov 23 '22 09:11 FarrisFahad