Bad autocompletion in SublimeText3 when pressing tab in PHP array
Asked Answered
C

2

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.

Compulsion answered 16/12, 2013 at 17:8 Comment(4)
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 as they are focused on just this software and not all of programming.Tenacious
I don't have an answer for you but this is caused by SublimeCodeIntel. As you noted, it's incredibly frustrating.Sumpter
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 <list> thing from happening. Or possibly could someone explain what <list> is supposed to do and maybe I'm just using it wrong.Givens
So happy to find this asked and answered. I am having a day full of arrays, and rapidly developing array/tab related rage. Serenity!Vaniavanilla
T
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.

Task answered 2/1, 2014 at 16:2 Comment(7)
whereabouts is SublimeCodeIntel/codeintel2/tree_php.py? Cant find it anywhereRedolent
If you use OSX, you can try ~/Library/Application Support/Sublime Text 3/Packages/SublimeCodeIntel/libs/codeintel2/tree_php.pyCrump
On Win7 I found the file in SublimeCodeIntel/libs/codeintel2/. I deleted the lines and removed .codeintel but it didn't fix it.Macaw
I'm crying on my knees.Reproduction
In Sublime Text 3, packages are installed as binaries (through Package Control), so this solution does not work.Admittance
@Admittance 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.Task
@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! github.com/SublimeCodeIntel/SublimeCodeIntel/pull/390Admittance
S
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.

Scad answered 23/12, 2013 at 19:47 Comment(2)
This solution is helpful, but it will deactivate all my auto-completion, and i just want deactivate this specific auto-completion, not all.Compulsion
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.Nicolina

© 2022 - 2024 — McMap. All rights reserved.