Sublime Forum

Autocompletions not showing variables from file

#1

I have added some .sublime-completions file and put jQuery and JS functions and stuff there.

Completions works greate! But now I am facing another, worse problem:
Autocomplete box shows me local variables (words from buffer) only after there is no more matches for completions from .sublime-completions file ?!

As can be seen from screenshot:

I have 3 variables starting with word new, but since I have 2 matches from my completions file, those gets completely ignored… I get local variables in autocomplete box only after I write ‘newp’ that doesn’t match any word from file.


I know that words from buffer has lowest priority for autocomplete. It doesn’t make sense to me but I could live with it. But I thought that I would still get my local variables at the end of autocompletions list. So in the example above it should be:
‘new’ - autocompletions: ‘new’, ‘innerWidth()’, ‘newPageCloseModal’, ‘newPageRedirectToEdit’,…


My questions:

  1. How to achieve that ‘words from buffer’ are always at the end of my autocompletions list?
  2. How to set ‘words from buffer’ to have highest priority in autocompletion

Any help would be greatly appreciated! I am completely lost…
Thank you very much!

0 Likes

#2

It’s funny should ask about this, it is a bug, see SublimeTextIssues/Core#1061.

0 Likes

#3

Could you name a package or include a completions file that causes this behavior for easier reproduction?

0 Likes

#4

The parens in the completion innerWidth() is causing the problem.

1 Like

#5

Thank you all very much!
The problem were special characters in completions triggers that were not within [A-Za-z_-] !
I removed all of those and now it works as expected!

It is pity though I that for anything advance I need to create new snippet file :frowning:
Also it is very lousy that you can not write multiple snippets in one file which makes it very hard to maintain.

Am I wrong or development on Sublime has stucked? So it is very unlikely this bug is ever gonna be solved?

0 Likes

#6

Please elaborate why you need to create a new snippet file instead of just defining a completion that does not use any of the faulty characters in the trigger.

0 Likes