A web development tool that can immediately understand the concept of more than one language in a file

I am currently using notepad ++ on windows or gedit on ubuntu. Both of them do a great job with code highlighting and hint, etc. But both of them suffer from a huge flaw. I have 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 need to agree on one language. I want something that might think that the default text is used as HTML, but pay attention when sections are PHP. I want these sections of PHP to contain their own code that hints and highlights. Even more, say, in "if else", I exit PHP, write the HTML code back to PHP, I want it to work, as the brackets ('{' and '}') should match and tell me if I missed one. I want embedded JavaScript sections to be matched as such. I want all these languages ​​to be checked for syntax!

Heck, I want a tool that understands several languages ​​at once!

Extra

It should be noted that I do not want to pay for such a luxury: P

My files are saved as '.php'.

Notepad ++ may work that I use PHP, but when I exit php and do some HTML and / or some JavaScript.

+4
source share
4 answers

Try Eclipse with a PDT or Eclipse-based IDE like Aptana or Zend Studio .
Or try Netbeans . Everyone should do what you want.

If you cannot decide what to use, see the various Q&A questions in this thread.

+2
source

PHPStorm is probably the most powerful environment for your requirements. Cut, but release. I think it's worth it ...

+3
source

Emacs , with nxhtml .

+2
source

gedit , based on gtksourceview , absolutely supports nested language blocks. If I save your example as .php , I get syntax highlighting for PHP and HTML.

Indeed, for JavaScript in <script> blocks, although not built-in attributes of the event handler. (Which would be difficult because it is not CDATA, they are HTML: the syntax marker should have known what if (a&amp;&amp;b) represents. In any case, you do not want to use event handler attributes.)

+1
source

Source: https://habr.com/ru/post/1307995/


All Articles