This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 194149 - hints for syntax higligting for other languages in (PHP) editor
Summary: hints for syntax higligting for other languages in (PHP) editor
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: Dev
Hardware: All All
: P1 normal with 3 votes (vote)
Assignee: Ondrej Brejla
Depends on:
Reported: 2011-01-09 00:32 UTC by k2s
Modified: 2017-05-31 14:52 UTC (History)
2 users (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description k2s 2011-01-09 00:32:21 UTC
I often have to write javascript, css or HTML code inside a PHP/PHTML file.

1. Here syntax highliting will work:
echo "test";
<script type="text/JavaScript">
var v = "also test";

But often I use heredoc and in Zend Framework it is the best to use view helpers like $this->headScript() and then it will not work.

2. Heredoc example:
var v = "also test";

3. Zend helpers add correct starting tags and move the string to head part of page so I can't add my own SCRIPT tag which would help to highlight correctly.
<?php $this->headScript()->captureStart(); ?>
var v = "also test";
<?php $this->headScript()->captureEnd(); ?>

Possible solution:
I think mixed syntax higlighting is supported in PHP editor, becasue it works in example 1.

I don't saw solution in other editors I worked with, but I would like at least to propose.

heredoc: define reserved heredoc names (<<<HTML, <<<JAVASCRIPT, <<<) and use them as hints

other situations: let user to define own (or define fixed) start/end strings assigned to highlight language.
For example I would define in Netbeans configuration javascript=>("//jssyntax", "//.jssyntax")

Then I would have to write:
<?php $this->headScript()->captureStart(); ?>
var v = "also test";
<?php $this->headScript()->captureEnd(); ?>
Comment 1 tubaguy50035 2012-08-02 19:38:55 UTC
This would be lovely.  Updated version to 7.2 since it still does not exist.
Comment 2 micahgreene2 2016-12-29 22:55:52 UTC
I am looking for something similar, and if I know where to start looking the the source code I will see if I can start on a prototype. 

I would like to use the existing netbeans highlighting settings for the languages and just call them when I use heredoc <<<language_name

If anyone could point me in the right direction that would be helpful

Even if I knew where the definition of how heredocs is defined as a string that would help.
Comment 3 semoriil 2017-05-31 14:46:27 UTC
JetBrains PhpStorm has similar functionality.