Ultraedit, PHP 5 and the function list.

UltraEdit

I was working on some PHP development recently with my editor of choice, UltraEdit. In my view, UltraEdit is the text editor to use. (Assuming you’re in a Windows environment) It basically has everything I need, and is especially well-suited for web development. Where it may fall short is for developing desktop applications, as then a specific IDE may offer more features, though UltraEdit can be configured to work with compilers and so forth. (UEStudio is probably a better choice in this case)

While I don’t want to argue about the merits of UltraEdit, as people’s passion for their text-editors seem to border on the religious, I wanted to point out a potential solution to a code highlighting problem some of you may have encountered when developing with PHP 5.

Missing functions in the function list

UltraEdit supports code highlighting through its wordfile.txt file, which stores the configuration information for highlighting different languages based on their file extension(s). This file can be found in the directory you installed UltraEdit to, or it can be accessed via the configuration menu. This file determines what language highlighting options show up in the “View As” list. It also allows the function list to display a list of functions/methods in the current file by defining what strings are function declarations.

PHP 5 supports classes and objects better than previous versions. In particular, setting the visibility of members is now supported. So, you can define, for example, methods to be public, protected or private. (The default is public)
However, when using one of these keywords to define a method, the method seemed to disappear from the function list. This was with using UltraEdit 12.10.

Modifying the UltraEdit wordfile file

You need to get the PHP 5 word file and then add it to your word file. Open up wordfile.txt (in UltraEdit, of course!), and delete the entire definition block previously used for PHP. It’ll start at a line of text that begins with:

Lx"PHP"

Where ‘x’ is a number. The end will be just before the next language definition, which will be something like:

L(x+1)"LanguageName"

You need to delete everything starting from the the first line to just before that last line. Then, you can copy and paste in the contents of the PHP 5 word file, changing the first line’s L20 to Lx, where ‘x’ was the number as before. Public, protected and private-declared methods should now show up in the function list.

UltraEdit and Regular Expressions

The UltraEdit word file is actually a bunch of regular expressions that tell UltraEdit which lines are function declarations (among other things) so that it can populate the function list with them. In the past, it would appear that the wordfile doesn’t use Unix-style RegExps but instead uses some sort of UltraEdit format. I don’t know if this behaviour has been changed since then, but looking at the word file, it appears that this is still the case.

You see, UltraEdit has its own style of regular expressions. While you have the option of searching within text files using either UltraEdit’s style, Unix, or Perl-compatible regular expressions, it seems as though the word file language definitions must use UltraEdit-style regular expressions.

4 Comments »

  1. Thanks for posting this! Made my life that much easier.

  2. Thanks! Googling up your post was much easier and faster when I just needed the PHP5 functions to show up, than messing with UE’s site for wordfiles.

  3. @Jay, Lanae
    Happy to help! But I’ve now since moved on to using Eclipse for all my coding needs. I recommend you take a look at it.

  4. I checked my wordfile as stated. worked great

    i now see my parameters in my function list when i request the list/tip

    and i also see the parameters in my ojects methods

    BUT NOW I LOST the capability for code folding:(

Comments are now closed for this entry.