Home Download Buy Blog Forum Support

[Variable completion] / php

[Variable completion] / php

Postby vbenner on Fri Mar 16, 2012 2:53 pm

Hello,

I discovered Sublimetext after reading an article through a mac developpers website.

As I use until now textedit and also coda, I'm searching for a better php editor.

Sublimtext seems to have major advantages with auto completion feature but, cause
I switched to Mac 5 years ago, I cannot find the best features of my old Windows phpDesigner
(http://www.mpsoftware.dk/).

1/ Sublimtext is very good 'cause it's light and fast (compared to Coda / Textedit / Komodo
or netBeans)

2/ Sublimtext missed a terrible feature : autocompletion right after the $ character (for dummy
variables $i, $j) or $_ (post / get / session / ...)

Do you think that the 2nd feature will be released ????

Thank you,

Vincent
vbenner
 
Posts: 3
Joined: Fri Mar 16, 2012 2:40 pm

Re: [Variable completion] / php

Postby PhilippSchaffrath on Fri Mar 16, 2012 5:41 pm

Shouldnt be a problem for you, to create a plugin wich provides this functionallity. Even if you have no experience with python it isnt that hard to understand!
By the way, its fun to create plugins ;)
PhilippSchaffrath
 
Posts: 17
Joined: Sat Mar 10, 2012 1:24 pm

Re: [Variable completion] / php

Postby C0D312 on Fri Mar 16, 2012 8:56 pm

Add the following to your user keybindings:
Code: Select all
   "auto_complete_triggers":
   [
      {
         "characters": "$",
         "selector": "source.php"
      }
   ]


Autocomplete by default only triggers when typing letters and numbers; however, this setting allows you to add language-specific special characters. In this case, $.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: [Variable completion] / php

Postby vbenner on Mon Mar 19, 2012 9:42 am

Hello,

I opened the Preferences -> User Key binding and add the following code :

Code: Select all
"auto_complete_triggers":
   [
         {
          "characters": "$",
          "selector": "source.php"
      }
   ]

But when I save it, I've got the error message :

Error trying to parse file: Unexpected trailing characters in ~/Library/Application Support/Sublime Text 2/Packages/User/Default (OSX).sublime-keymap:1:25

What's wrong with it ?

Thank you,

Vincent
vbenner
 
Posts: 3
Joined: Fri Mar 16, 2012 2:40 pm

Re: [Variable completion] / php

Postby nick. on Mon Mar 19, 2012 1:11 pm

If there were settings in the file, you'll have to add commas between the keys, like so:
Code: Select all
{
    ...
    "some_other_setting": "value",
    "auto_complete_triggers": [ { "characters": "$", "selector": "source.php" } ]
}
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Re: [Variable completion] / php

Postby vbenner on Mon Mar 19, 2012 2:04 pm

Ok, it's perfect ! I made a mistake and tried to implement it into keybinding instead of settings -> users !

Sublime Text won a battle versus Coda / TextMate......

Now, how to autocomplete $_POST and $_ prefixed variables.

--> I answer to myself --> TAB key after _ key is quite good ! (a laiziest keymap on _ would be preferable
but it's acceptable)

Thank you

Vincent
vbenner
 
Posts: 3
Joined: Fri Mar 16, 2012 2:40 pm


Return to General Discussion

Who is online

Users browsing this forum: Yahoo [Bot] and 33 guests