Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bad autocompletion in SublimeText3 when pressing tab in PHP array

Tags:

I'm using SublimeText3.

When i work in an array in PHP, the autocompletion proposed by pressing Tab totally annoys me.

I just want to add some tabulations, but at each time i press Tab, sublimetext propose me :

array(<list>) Create a PHP Array. 

If a just press Tab again, he valid the proposition and write in the file <list>.

I've installed this plugins :

{     "installed_packages":     [         "Alignment",         "ApacheConf.tmLanguage",         "BracketHighlighter",         "Comment-Snippets",         "Comments Aware Enter",         "eZ Publish Syntax",         "HTML5",         "jQuery",         "LESS",         "SublimeCodeIntel",         "sublimelint",         "Symfony2 Snippets",         "Theme - Soda",         "Twig"     ] } 

If someone knows how to disable this bad proposition or to correct it ?

Thanks.

like image 294
kaal Avatar asked Dec 16 '13 17:12

kaal


2 Answers

Update 01-29-14

Over on Github someone found a better solution than the one I posted previously. New Solution.

Open up your_packages_folder/SublimeCodeIntel/codeintel2/tree_php.py and add array to the tooltip ignore array around line 140.

php_ignored_calltip_expressions = ("if", "elseif",                                    "for", "foreach",                                    "while",                                    "switch",                                    "array"                                    ) 

Old solution

I found a temporary solution on github.

Comment out or delete line 100 & 101 in SublimeCodeIntel/codeintel2/tree_php.py

"array": "array(<list>)\n" "Create a PHP array.", 

Then delete the ~/.codeintel folder in your user dir on OS X, not sure where this cache lives on windows.

like image 123
Matthew Nie Avatar answered Oct 24 '22 10:10

Matthew Nie


Just started using Sublime Text 3 and this issue has been bugging me for a couple weeks. Even with "auto_complete_commit_on_tab": false and "tab_completion": false, it persisted. I ended up looking in the Sublime Forums and finding this thread, which suggests you add this code to your Key Bindings:

{ "keys": ["tab"], "command": "insert", "args": {"characters": "\t"}, "context":     [         { "key": "auto_complete_visible" },         { "key": "setting.tab_completion", "operator": "equal", "operand": false }     ] } 

It essentially remaps your tab key to force a tab instead of allowing the snippet autocomplete to work.

like image 43
Paul B. Avatar answered Oct 24 '22 10:10

Paul B.