Sublime Forum

Setting "tab_completion" confusion



	"auto_complete_commit_on_tab": false,
	"tab_completion": false

Console result after pressing TAB while typing a word:

command: insert_best_completion {"default": "	", "exact": true}

I assume this is due to the keys configuration in the global key bindings file:

{ "keys": "tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} },
	{ "keys": "tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false},
			{ "key": "setting.tab_completion", "operator": "equal", "operand": true }

Only when I actually remove these lines from the keys configuration file, does TAB not cause a completion.
Hence, it appears the setting “tab_completion”: false does not work as it should.

It appears to have worked 6 months ago for this person: … -reindent/
but seems to be broken now?

1 Like


The setting is working as indented, that’s the command that should be triggered when tab_completion is set to false. Even when tab_completion is false, it is still designed to trigger snippets, which is what insert_best_completion will do when the exact parameter is true.



What do you mean by “when the exact parameter is true”? It doesn’t complete snippets, it simply auto completes words.
For example, if this text would be in a file, and i would type:

para, it would auto complete it to “parameter”
This is not a snippet, just a word.

That cannot be the intended behavior when the setting is set to “false”.



If the auto complete window is showing, pressing tab will always select the current entry: you’ll need to press escape first to hide the window.



Yes I am aware of that fact. This is however, very counter productive, since the auto complete window shows up for just about every single word I type.
And besides, if this is the case, what is the purpose of the setting “tab_completion”, if it is completely ignored?

And before you say it, yes I have tried setting the auto completion window delay from 50ms to 500ms.
This introduces another bug however, where the auto complete screen pops up randomly in inappropriate places when typing fast (for example behind a => or . symbol, yielding very strange results and the introduction of the word “php” when pressing tab). I made a screencast of this behaviour:

Look how often “php” is inserted. The auto complete system is really buggy.
I would really love to purchase Sublime and use it on all our machines in the office for each employee, but I am really reluctant unless these issues get fixed. I can’t be the only one who is affected by them.



Let me also put it in another way. If you say it is the proper behavior for TAB to complete the autocomplete, when the setting “tab_completion” is set to false, then tell me please how I can reconfigure Sublime so that it only accepts auto completions with ENTER only. Since both TAB and ENTER do the same now, it is a bit redundant.

From the Sublime documentation I think the setting is clearly meant to disable auto complete on tab:

[quote]Disabling Tab Completion

Sometimes tab completion isn’t desirable. To turn it off, add this line to Preferences/File Settings - User:

“tab_completion”: false[/quote]



JPS, can you reply to my last 2 comments?



Still awaiting a conclusive answer on this.



This is working by design



Seriously, how can you state that after reading all of the above?
There are like 3 different auto complete settings, and none of them work. Nice design.




I believe i’m hitting the same issue here. Any updates on this? Would love to be able to use to select the first selected item in the auto-complete list instead of .

Would love to hear back about this JPS. Thanks for the awesome product.



Pity this hasn’t been acknowledged as a bug. No change in the recent 2.0.2 update.

As a workaround I’ve found adding this setting to my user key bindings solves the problem:

[code]{ “keys”: “tab”], “command”: “insert”, “args”: {“characters”: “\t”}, “context”:

	{ "key": "auto_complete_visible" },
	{ "key": "setting.tab_completion", "operator": "equal", "operand": false }


When “tab_completion” is set to false, this forces the Tab key to insert a tab instead of selecting a match whenever an auto-complete window is visible. Use **Enter ** if you want to select a match.


Auto completion on tab refuses to go away

Still broken in Sublime 3.

When you type a letter, say ‘f’ and a completion popup appears it then does’t matter if “tab_completion” is false or true - pressing TAB will commit currently selected autocompletion word which might be or might not be a snippet. The documentation says that setting tab_completion to false should only complete snippets. This is not the case. If the last time you completed ‘f’ with a snippet - it will complete snippet the next time, if it was a word - it will complete a word. And ‘tab_completion’ option has absolutely no effect on this behaviour.

if tab_completion is set to false everyone expects that only pressing ENTER will complete from completion popup. Pressing TAB should only trigger matching snippets or insert tab symbol. This is not the case, please fix it.

Please have a look at the following posts mentioning the same problem: … -reindent/ … n-its-own/



This bug (or feature, whatever you want to call it) is really annoying, and still happening in 3084. Can we either get tab_completion fixed, or a new setting that does what the previous posters have requested?




tab_completion works exactly as intended: when true, pressing tab will complete the current word in the buffer, when false, it doesn’t, unless the auto complete window is showing.

If you want tab to not complete when the auto complete window is showing, then you’ll need to make a custom key binding, something along the lines of:

{ "keys": "tab"], "command": "insert", "args": {"characters": "\t"}, "context":
		{ "key": "auto_complete_visible" },


With your last suggestion it is possible to insert a tab when the auto completion window is visible. But it won’t trigger snippets if the auto completion window is visible. You need to close the window with ESC and then trigger the snippet with TAB.

How to make TAB (or any other key) to always trigger snippets, no matter if the auto completion window is shown or not?

Is there any argument to ‘insert_best_completion’ command that will tell it to use snippets only and ignore any currently selected word in a completion window?



I ended up with a simple plugin which binds on TAB in required context, closes autocomplete popup and then inserts matching snippet. This way TAB will always insert a snippet when I need it and mean it. And I’m able to use autocomplete again:



Still an issue, but this worked for me:

{ "keys": ["tab"], "command": "insert", "args": {"characters": "\t"} },
{ "keys": ["shift+tab"], "command": "unindent" },