1

I installed the WordPress bundle/ruble for Aptana Studio, but it's only providing code assistance for a subset of WordPress functions. I'd like code assistance for all WordPress core functions (or as many as possible). My projects have PHP as their nature, and are connected via SFTP to remote WordPress installations.

After the bundle (which hasn't been updated in over a year) didn't provide everything I was looking for, I tried using a local copy of WordPress as an external library, then adding it as an external directory to the PHP Buildpath. Neither one added any more functions than the bundle provided. These actions were suggested in Aptana Studio Support and WordPress Answers.

Am I doing something wrong, or is the level of code assistance I'm looking for not available?

2 Answers 2

3

It's true that the WordPress bundle offers just some limited auto-completion support. Though including the local copy of another WordPress installation as a PHP external library seemed to solve this in the latest Aptana Studio version (3.4.0,) as you already mention to have tried, and as it is suggested in this one of the links that you pointed out.

Here are all the specific steps I took, so you can check if there was something different in the procedure you followed.

  • Open the Preferences menu going to Window > Preferences
  • Select Aptana Studio > Editors > PHP > Libraries
  • Click "New user library"
  • Add the path to another local WordPress installation (not the same WordPress files in the current project,) selecting the root folder of a freshly extracted WordPress download (e.g.: C:\wordpress-3.5.1\wordpress)
  • Make sure the new library is selected in the user libraries list (marking it with a checkmark next to the library icon.)
  • Apply the changes and press OK
  • Make sure your project is a PHP project. Right click the project folder, select Properties > Project Natures and mark the PHP checkbox.

Now, inside PHP code, I get autocompletion suggestions for all core WordPress functions - and I can even go to check their source by pressing F3 on their function name.

7
  • Thanks for your reply, E. Serrano. Unfortunately, that doesn't seem to have worked for me. I added the library and Aptana showed that it indexed it, but I still don't get auto-complete for the majority of WordPress functions. I tested by opening an existing theme template file and typing various functions from the Codex Function Reference. I don't know what I'm missing.
    – warnerchad
    Jun 7, 2013 at 12:22
  • It's amazing. I closed the project I was working on, and after opening a new project, the WordPress-related auto-completion is gone! The right library is still imported there, but I'm experiencing the same issue you were mentioning. I've tried adding the library again, importing a different version, deselecting the working set, etc. with no luck.
    – E. Serrano
    Jun 15, 2013 at 0:52
  • I realized autocompletion doesn't work in Aptana projects set only as Web Project. But it does work when configured as PHP projects. So you can have full WordPress code auto-completion in Aptana following the aforementioned steps and adding the PHP project type for that specific project (right click on an existing project, Properties > Project Natures > Check PHP.) A little 'P' will appear on your open project folder, and PHP code assist will use the included WordPress libraries from now on.
    – E. Serrano
    Jun 23, 2013 at 17:37
  • My projects are already set to PHP projects, but I still only get auto-completion for a few functions (tested by opening an existing theme template file and typing various functions from the Codex Function Reference.
    – warnerchad
    Jun 24, 2013 at 18:15
  • 1
    Is PHP the Primary nature of the project? Do you also have the Web project nature assigned to that project? Alternatively, have you tried assigning the source WordPress directories as External Directories in the PHP Buildpath tab inside Project Properties?
    – E. Serrano
    Jun 28, 2013 at 4:01
1

I followed the steps of E. Serrano and it works perfectly. What is silly is that if you want autocompletion for, say, add_action('wp_print_footer_scripts', 'scripts.js', 1); the moment that you type the quote, autocompletion is lost... if you try add_action( wp_ you get all WP commands. Hope it helps...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.