23

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.

kaal
  • 335
  • 3
  • 12
  • I have had issues with packages and autocomplete before. Similar, but not same. I don't think I have any of the packages you have, but I ended up removing one or two until it went away. Since you know which ones you have, you could just try to remove one or two, see if the problem persists and repeat until it goes away. Also, you would probably get better results from the [sublime forums](http://www.sublimetext.com/forum/) as they are focused on just this software and not all of programming. – Jonathan Kuhn Dec 16 '13 at 17:25
  • 1
    I don't have an answer for you but this is caused by SublimeCodeIntel. As you noted, it's incredibly frustrating. – John Blackbourn Dec 31 '13 at 05:16
  • I am also very bugged by this. I don't have a better suggestion other than maybe instead of trying to get rid of this (since that seems next to impossible), but rather override this functionality with something different or more useful? I don't have a clue how or what can do that, but just looking at it from a different angle if it helps stop this thing from happening. Or possibly could someone explain what is supposed to do and maybe I'm just using it wrong. – solepixel Jan 01 '14 at 16:32
  • So happy to find this asked and answered. I am having a day full of arrays, and rapidly developing array/tab related rage. Serenity! – Tim Ogilvy May 09 '14 at 04:52

2 Answers2

29

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.

Matthew Nie
  • 629
  • 5
  • 10
  • 1
    whereabouts is SublimeCodeIntel/codeintel2/tree_php.py? Cant find it anywhere – Claire Jan 16 '14 at 10:37
  • 3
    If you use OSX, you can try ~/Library/Application Support/Sublime Text 3/Packages/SublimeCodeIntel/libs/codeintel2/tree_php.py – Jason McClellan Jan 26 '14 at 00:41
  • On Win7 I found the file in SublimeCodeIntel/libs/codeintel2/. I deleted the lines and removed .codeintel but it didn't fix it. – Mihai Scurtu Jan 29 '14 at 13:33
  • I'm crying on my knees. – sepehr Jun 07 '14 at 11:38
  • In Sublime Text 3, packages are installed as binaries (through Package Control), so this solution does not work. – aaronbauman Nov 11 '14 at 18:43
  • 1
    @aaronbauman I had this installed via package control, the above change will work it just requires overriding changes when an update comes through. It's a pain but it solves the problem, which I think is worth the work. – Matthew Nie Dec 16 '14 at 15:34
  • @MatthewNie thanks - i eventually figured out how to manually download the package source and implement this change. Please go bug the maintainers to merge this pull request! https://github.com/SublimeCodeIntel/SublimeCodeIntel/pull/390 – aaronbauman Dec 16 '14 at 17:38
1

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.

Paul B.
  • 66
  • 2
  • 1
    This solution is helpful, but it will deactivate all my auto-completion, and i just want deactivate this specific auto-completion, not all. – kaal Dec 24 '13 at 11:21
  • Thank you, thank you, thank you! This was driving me nuts. It should be noted that "tab_completion": false still needs to be set for this to work. – Lukas Aug 26 '14 at 13:11