Sublime Forum

PHP Function Explanation Bugs

#1

Since recently, PHP Function Explanation doesn’t work as before.

For example, if you want to display the parameters of the in_array() function by pressing TAB, Sublime creates

in_$arrayName = array('' => , );

which isn’t useful.

If you want to display the parameters of preg_match() by pressing TAB, Sublime creates

  preg_match (variable) {
    from => to,
    default => null,
  }

which isn’t useful either.

This is pretty annoying when you always forget the order of parameters like me.

Please fix, thanks!

0 Likes

#2

In the in_array case, ST thinks the user want to complete the array, which is wrong since in_array is a single token rather than in_+array. Looks like a bug when there is not really a full trigger match (ST thinks there is array, which is a full trigger match) for a snippet.

The preg_match example is the same.

0 Likes

#3

OK, workaround is extracting contents of Packages/PHP and renaming/removing
new-array(-).sublime-snippet,
match{-}.sublime-snippet etc.

Yes, .sublime-completions should always prevail .sublime-snippets.

0 Likes

#4

Since you are using ST4, there is an easier workaround.

Something like the following but modify it to your needs.

    "ignored_snippets": [
        "PHP/Snippets/new-array(-).sublime-snippet",
        "PHP/Snippets/match{-}.sublime-snippet",
    ],
0 Likes

#5

Issue tracked on https://github.com/sublimehq/sublime_text/issues/4667

0 Likes

#6

Curly braces: match{-}.sublime-snippet

BTW I have to press TAB twice now to show params; it used to be once.

0 Likes

#7

It’s reported somewhere in this forum but I was not tracking it since I use LSP-intelephense and not reply on ST’s autocompletion (and somehow I prefer Enter than Tab… I don’t know why.).

0 Likes

#8

Just noticed that pressing TAB after preg_match shows other functions starting with that, like preg_match_all(), so maybe that is useful.

0 Likes