Reputation: 8650
I currently use notepad++ on windows or gedit on ubuntu. Both of them work great with code highlighting and hinting etc. But both of them suffer from a huge flaw. I am yet to find a code editor that can handle this concept:
<?php
// ooh, look I am doing some php
?><a onclick="alert('hay, some javascript in here now!')">
This link is HTML?!</a>
<?PHP
echo("NOW we have some php as well!");
?>
At the moment, I just have to settle for the one language. I want something that can think of a that text as a default as HTML, but notice when sections are PHP. I want those sections of PHP to have there own code hinting and highlighting. Even more, lets say in an 'if else' I exit PHP, write some HTML then back into PHP, I want it to work out how the braces ( '{' and '}' ) should match up and let me know if I have missed one. I want the sections of in-line JavaScript to be picked up as such. I want all of these languages to get checked for syntax!
Damn it, I want to tool that understands more than one language at once!
Extra
Should point out that I am not willing to pay for such luxury :P
My files are saved as '.php'.
Notepad++ is able to to work out that I am using PHP but when I drop out of php and do some HTML and/or some JavaScript.
Upvotes: 4
Views: 183
Reputation: 536489
gedit
, being based on gtksourceview
, absolutely does support nested language blocks. If I save your example as .php
, I get syntax highlighting for both PHP and HTML.
And indeed for JavaScript in <script>
blocks, though not inline event handler attributes. (Which would be tricky because those aren't CDATA, they're HTML: the syntax highlighter would have to know what if (a&&b)
represented. Anyway, you don't want to be using event handler attributes.)
Upvotes: 1
Reputation: 15621
PHPStorm is probably the most powerful IDE for your requirements. Pricey, but give it a go. I think it's worth it...
Upvotes: 3