Can you enable variable highlighting with Eclipse PDT? - php

I'm using version 3.3.2, I know that regular Eclipse for Java does variable highlighting.
Notepad++ does it regardless of what language you're using (if you select any text, it highlights similar text)
I know it's not critically important, and a back/forward incremental search is an adequate workaround, but it would be nice to have.
Update Looks like I had PDT 1.03, (current version is 2.0), I have Eclipse 3.2.2. Needed to look in "Help -> Software Updates -> Manage Configuration", not just "Help -> About".

You can download new PDT 2.0 All-in-one together with Eclipse 3.4 - this feature as "mark occurences" is here an there is some new features. I use it now and found it stable.
http://www.eclipse.org/pdt/downloads/

I believe 'mark occurrences' is the option which is the closest of what you call 'syntax highlighting'
But PHP Development Tools (PDT) had not that feature in 2007, according to this discussion.
However this bug says PDT1.1 has now the ability to mark occurrences.
Full description in this pdf document.

I think your question in poorly worded. Syntax highlighting, and highlighting all similar strings are very different.

Not sure about PDT but I would suggest to try PHPEclipse plugin instead, which is much more powerful. It gives you pretty much everything that Eclipse provides for java - marking occurrences, Ctrl-click navigation, code completion, etc.

Another trick is to highlight the word then right click -> refactor -> rename OR just Alt-Shift-R
This highlights all occurrences of the variable.
Esc key to stop highlighting.
Just be sure you don't accidentally rename it (easy enough to undo if you do).

Related

Why notepad++ autocomplete doesn't work with function arguments?

I checked "Settings > Prefences > Backup/Auto-Completion > Enable Auto-completion on each input" and "Function parameters hint on input" options. I have Notepad++ 5.9 (unicode) version. It auto completes function names but not their arguments. Also i tried re-install. I know it has this feature but not working. Any idea why?
I mean it auto completes print_r when i write "pri" but i want it to work like in the image;
http://i51.tinypic.com/3322auc.jpg
Hmm, this is not an answer to your question but I want to share it anyway.
I have used Notepad++ for years. I didn't like Eclipse and NetBeans is just so damn slow.
I never used the auto complete function for anything.
Notepad++ can't really do any code analysis, it can only give you auto-completion on the known PHP functions.
I've since switched to an IDE that does full code analysis and can do auto-completion for your own code as well.
Notepad++ is great if you just want to write something real quick. It's also a great tool if you want to learn about PHP since it doesn't do auto-completion very well ;) but if you really want to be productive when you're working on a large application I recommend you use an IDE that does code analysis. Productivity is the key here. I spend less time looking through files and more time actually writing code, which is great! :D
Good IDEs for PHP: NetBeans, PHPStorm, Eclipse.
For this feature to work, you need to supply an .xml file which contains the appropriate functions and parameters.
An example for Javascript with installation instructions can be found here.
I have not yet found xml files for PHP (or Python, which I'm looking for). But it seems this can work in npp, you just need to locate the right xml file.
Best of luck!
(Oh, and don't listen to the naysayers who are too quick to give up, npp works fine as an IDE.)
Notepad++ it's very good text editor, but it's not IDE.
Try to use IDE - NetBeans or PhpStorm, and you will get much more than just smart autocomplete.
I have a same question about this, function hint is Ok,but param hints not display until I download a new release of notepad++(a not install release), all is ok. before, I tryed many time, and edit the xml files.
If you will edit you own language, Can copy from a exist language xml ,for cpp.xml in plugins/APIs folder. It's easy to understand its rule.
It is very easy to have a error, if you config file is changed.

Enable PHP highlights in VS 2010?

I've heard that Visual Studio 2010 Beta 2 has support for PHP. When I load a PHP file though, it has nothing highlighted and is nothing more than a glorified text editor.
Is there a way to enable it?
You can enable syntax highlighting for php files using a simple hack in Visual Studio 2010 (might also work for earlier versions)
Open Tools -> Options dialog from the menu, and select Text Editor -> File Associations on the left. Add php as a new extension and select 'Microsoft Visual C++' in the adjacent combo box. Apply and now you and open and edit any php file in Visual Studio with Syntax highlighting and code folding. The only problem come is when the file has mixed php and html code. It does not look really good and editing is painful.
I have tried VS.php, and I am certainly not impressed. The only thing it can add to visual studio is creating a php project easily, otherwise, I haven't been able to find it any more useful.
As far as I know, we don't do PHP support out of the box. You probably need a third-party component such as this one: http://www.jcxsoftware.com/vs.php
I've found by using the VS2010 script editor for PHP it does 90% of what I wanted.
As Samnan states - goto Open Tools -> Options dialog from the menu, and select Text Editor -> File Associations
and told VS2010 to use its script editor
Also XRefresh plugin for firefox is quite handy for quickly viewing code changes on a second monitor running firefox.
On Microsoft Connect, it seems that this is a feature request. And they've talked about it on MSDN. But so far, syntax highlighting doesn't seem to be a builtin feature just yet. Though, Expression Web 2 and 3 do have IntelliSense in the HTML designer, we could be seeing native syntax highlighting in the Visual Studio 2010 RTM come March.
Hope this helps.
I've heard rumors about them adding it in the final release, however there is no native support for PHP within the beta right now.

Netbeans-esque retrospective auto-comment/phpDocumentor tool (for Eclipse or standalone)

Is there anything similar to netbean's Javadoc auto comment tool for PHP/phpDocumentor/Eclipse? In the netbeans implementation:
A dialog pops up and allows you to run
through all the members of your class
and enter comments, which are added to
the source file. It even verifies that
there are no parameters you have not
accounted for, so you can be sure that
your comments are complete.
Ideally this would be standalone software, but plugins are OK too :)
p.s. netbeans 6+ auto comment was moved/renamed. Now in "Tool->Options", Tab: "Java Code", Javadoc: "Hints"
edit: screengrab of the original Netbeans tool:
(source: vsj.co.uk)
Also if you use vim, you'd be doing yourself a great disservice to not look at Tobias Schlitt's VIP toolset (VIP = VIM integration for PHP).
I'm not sure if eclipse has an auto documenting feature or not, but you might check out http://www.zend.com/community/pdt. Eclipse is basically like netbeans, but it is very easy to obtain plugins for a multitude of other languages. The link I gave should give you eclipse with the php part included.
Not quite automatic, but close. Here is how to generate phpDocs from your PHP code

PHP syntax highlighting in Visual Web Developer?

I recently installed PHP 5 on IIS, however, I am unable to find a PHP syntax highlighting plug-in or extension for VWD. Where can I find a plug-in? I thought there was an official one.
Consider PHP IDE for Visual Studio.
http://www.jcxsoftware.com/vs.php
I have used this and it adds a lot of nice PHP specific features to Visual Studio.
From their site...
Editor and File Management
•PHP4 and PHP5 Support
•Syntax Coloring for PHP, Smarty, HTML, JavaScript, CSS, XML and XSLT
•File templates for PHP, Smarty, HTML, JavaScript, CSS, XML and XSLT
•Intellisense for PHP, Smarty, HTML, JavaScript, CSS, XML and XSLT
Debugging
•XDebug and DBG support
•Debug PHP, JavaScript and .Net in one single session
•Built-in Apache web server for ease of debugging. Preconfigured with Php4, Php5, XDebug and DBG.
I've tried a lot of text editors, some free, some commercial. So far Visual Studio is the only one that has the right combination of features to be most useful to me. So, coding PHP in VS is important to me.
You can trick Visual Studio (and hopefully also Visual Web Developer) into thinking .php files are C++ with a registry hack. The syntax highlighting is close enough to be useful.
This blog post explains how to do it for all versions of VS: http://blog.cumps.be/visual-studio-2008-and-php-coloring/
I don't know about older versions, but VWD 2010 allows you to link any extension to any type of formatting in its options.
Tools->Options
click 'show all options'
Expand 'Text editor'
click on 'file extensions'
type in 'php' and select how you want it to be formatted (I recommend the Automatic Editor Selector), click Add
And there you go! Next time you load the page you will see the changes. If you don't like it, there's 20 other styles to choose from.
There is no official plugin for PHP for Visual Web Developer. I believe that this is because Microsoft would rather you use their .NET products, (notably ASP) which serves most of if not all of (I can't exactly say as I don't really use ASP as much as PHP) of the functionality of PHP.
There are however, some very good PHP IDEs out there. A list of which you Here
thx, I use the last post with "HTML format" instead "automatic editor selector"
I would recommend using Netbeans. It has code completion for PHP and runs xdebug for debugging. I've been using it for over a year and the support for PHP just keeps getting better.
Definitely worth trying.
I would recommend Visual Studio with this Extension :
http://phalanger.codeplex.com/
It is free and gives you more functionality than most of the expensive tools.
if you're using windows there's an application called notepad++ that will do syntax highlighting for dozens of languages. I used it for C but I know it has a php syntax highlighter and many more languages coming along. Check it out on sourceforge. If your using Linux or Unix you can use K Advanced Text Editor (kate). It also has a console window built in.
What I am looking is for a debugger for PHP that is as useful as the one built into Visual Studios. I searched high and low for this and there seems to be none that works well.
What I used is the PHP Designer 2007 - Personal Version 5.0.2 is a fully functional php editor, for free! from mpsoftware[dot]dk/, however I like using MSVWD a lot too, and now that I've seen how to make php files work in it, I gonna stick with that! Thanks!
btw Aptana Studio looks promising too tho
The closest Visual Studio like PHP environment I have found yet is CodeLobster. It has a free version for PHP and CSS, as well as for pay versions that include for the Pro version a plug-in for CakePHP, CodeIgniter, Drupal, Facebook, JQuery, Joomla, Smarty, Symfony, WordPress and Yii.
It isn't perfect, but it is pretty good and free for the basic version.

phpeclipse: jump to function definition?

From zend's IDE I know that Ctrl+left click on a function name opens the corresponding source file and jumps to the functions definition
Is there anything similar in eclipse especially phpeclipse OR CDT?
I'm not sure if its just a window->preferences setting I don't see OR some kind of source code indexing I may have disabled which also don't find in the settings (if available)
Anyone knows the right settings?
I'm using eclipse 3.4.1 with pdt 2.0.0.v20081229.
Using Juno and PDT (PHP Development Tools) you can add this useful feature to a project in this way:
right click on the project -> Configure -> Add PHP Support.
Ctrl+Left click usually works in Eclipse as well, although it's horribly slow to react. For that reason I usually use F3 after moving the caret to the function name.
The thing with Ctrl+Click can be found in the preferences in "General > Editors > Text Editors > Hyperlinking". It can be turned off, there. But this function apparently required support from the respective editor/parser to be available at all.
The F3 key is bound to "Open Declaration" here. If that's not the case this mapping can be manually added, otherwise it may be that Eclipse is just not able to do that with PHP.

Categories