Heredoc HTML highlighting in PHP #13062

Open
cisco92 opened this Issue Jan 24, 2017 · 5 comments

Projects

None yet

3 participants

@cisco92
cisco92 commented Jan 24, 2017 edited

Hi,

Is there anyway of getting HTML markups and highlighting when using heredoc or newdoc in PHP?
Like in sublime you can type the wanted markup language after the <<< to get the correct markup, so like:
<<<HTML blablabla HTML;

I really want this to work in brackets also since a lot of HTML get's written in heredoc and it's all just plain orange.

Hope someone can help me out!

Best Regards
Cisco

@petetnt
Member
petetnt commented Jan 25, 2017

Hi @cisco92,

can you give an example? It seems that Heredoc should work out of the box (related: codemirror/CodeMirror#3421).

Which syntax highlight mode are you using?

@cisco92
cisco92 commented Jan 25, 2017 edited

@petetnt

example

As you see in the picture the code in Heredoc is not highlighting correctly..

In the bottom right of Brackets PHP is selected.

@petetnt
Member
petetnt commented Jan 25, 2017

Thanks @cisco92,

The Heredoc part seems to be working as it should, as Heredoc can contain any file or input stream literal. Sadly that means that means that the contents could be highlighted inside the Heredoc in nearly any way possible, which is why CodeMirror opts to just highlight interpolated variables.

The solution would be some kind of mixed mode, where the contents of the Heredoc would be highlighted according to the start/terminating strings. I suggest you'll file this upstream (https://github.com/codemirror/CodeMirror) , but most likely this would be better handled as an external plugin.

@petetnt petetnt closed this Jan 25, 2017
@ficristo ficristo referenced this issue in codemirror/CodeMirror Feb 6, 2017
Closed

PHP mode: Heredoc strings and syntax highlighting #4550

@ficristo
Member

Filed codemirror/CodeMirror#4550.
The CodeMirror mantainer is open to accept a PR but he will not implement himself.

@ficristo
Member
ficristo commented Feb 14, 2017 edited

I've submitted a fix upstream. Let's see how it goes. Reopening for now.

@ficristo ficristo reopened this Feb 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment