Autocomplete Weirdness


#1

Atom Version: 1.26.1 x64
Autocomplete Packages: Only Core packages enabled. atom-autocomplete-php is installed but disabled.

I’m having an issue with autocomplete. I noticed it first in lua, but it is also in javascript. It’s a bit of a weird one. Not commonly found, but very reproducible (for me)

  • Step 1: make a variable/function/anything with the name getChestAndSlot. I’m sure it works with other stuff, but this is the one I’m running into.
  • Step 2: start typing an if...then...end block. With lua it looks like this:
    if condition then
    – Do something
    end --if
  • Result: When I hit the return key at the end of then, it autocompletes to
    if condition getChestAndSlot
  • This is problematic because I touchtype without looking sometimes, and when I look up after typing end, all my tabulation is off and I have to manually change that and manually change getChestAndSlot back to then. And it’s just a big hassle.

Current solution: rename the function name `getChestAndSlot


#2

Uh… this posted prematurely without being able to preview and now I cannot edit. I hit some combination of tab, the tick key, and escape. I did not hit enter.

At any rate, I don’t really want to rename my function. And I don’t want to have to avoid hitting enter after typing then. But I also want to keep autocomplete available. Are there any solutions?

Oh, and the reason it autocompletes to that particular name is because it’s “getChestAndSlot”


#3

You might need to be more explicit about what to write. Saying “variable/function” doesn’t help anyone who doesn’t know Lua syntax.

As for the issue, is there a menu appearing with the potential autocompletions before you press enter? Or is it just suddenly changing?

Finally, can you confirm you did this in safe mode. I know you said everything was disabled, but safe mode ensures you didn’t miss anything.


#4

You should go into the settings for the autocomplete-plus package (Settings -> Packages -> autocomplete-plus). There you will find a few options. The one I would go with for your case would be to confirm the suggestion on either tab or tab always, enter when suggestion explicitly selected.


#5

DamnedScholar has my almost-solution. And, Aerijo, the lua syntax doesn’t matter. I said variable/function/anything. All that matters is that there is a user-defined word getChestAndSlot and a reserved/keyword then. In lua, then happens to be highlighted. In other languages it is not. But even in plain text with no reserved words, this should not be the behavior. Actually, all that matters is that both of those words are present somewhere in a currently opened file.

AtomIssue_0001

Expected behavior: Type then and return. I get then and a new line.
Actual behavior: Type then and return. I get getChestAndSlot and a new line.

Basically, the problem is that when I complete a word myself, it is taken out of the autocomplete list, so when I hit ‘enter’ it autocompletes to something else. The annoyance is that I have to hit arrow keys, escape, or mouse button to avoid it. And yes, I tried it in safemode and plaintext. Problem persists.

DamnedScholar’s workarounds are the most viable. Including tab always, enter when suggestion explicitly selected. to allow me to skip autocomplete more easily, and the price of convenience on other words. And Use Strict Matching would filter out silly results, at the cost of filtering out some good results (such as chest would not autocomplete to getChestAndSlot or saveChest)

I can’t find it on the settings list, but the ideal solution would be to keep completed words in the autocomplete list. So then would stay in the list and override getChestAndSlot. But save for that, I have my answer. Thank’s Scholar!