The only way to prevent it is to hit escape to cancel the completion panel, atm.
Maybe I am missing something, but I doubt tab_completion
to be involved here (in source
scope).
tab_completion
has no useful effect in source scope with auto_completion: true
as in that case snippets are always auto-completed while typing and hitting tab always expands them.
tab_completion
makes a difference only in text
scope or if auto_completion: false
is set. In that case it decides, whether a snippet trigger must perfectly match to expand a snippet via tab, or whether a partly written trigger is completed and than its snippet expanded.
Completion panel is automatically triggered at $1
as it is located after an accessors ->
, which is controlled by auto_complete_triggers
setting.
I would have expected auto_complete_with_fields: false
preventing auto-completion from being triggered within snippet fields, but his setting seems not to have any effect anymore.
Once completion panel is displayed, tab key always runs commit_completion
command, regardless any setting being changed. This seems to be required for backwward compatibility reasons with how snippets have been treated in ST3 if the inline tab_completion
functionalty was used. It no longer exists, so snippets and completions are both provided by completion panel, which has some edge cases or unexpected side effects.
There’s a "auto_complete_commit_on_tab"
setting, which defaults to false
and says completions would be committed via enter
by default. The description is at least out-dated (or even wrong). The setting actually only disables enter key if set true
.
To reproduce:
-
create a snippet
<snippet>
<content><![CDATA[
Hello->$1 is a ${2:snippet}.
]]></content>
<tabTrigger>hello</tabTrigger>
</snippet>
-
Create a new view
-
set syntax to PHP
-
Add <?php
tag
-
Start typing hell
<?php
hell|
-
hit tab
I’d expect "auto_complete_commit_on_tab": false
to cause completions to only be committed via enter, but it would effect how snippets are treated.
There are definitely some odds between how snippets and completions and the way the legacy insert_best_completion command has been interpreted in new ST4 completion system - especially in source
scopes. Some of them might already have been issued at Github.