Sublime Forum

Different scopes for HTML in PHP files vs normal HTML files

#1

I realize this might not be possible, but I think having different scopes for HTML in PHP files and HTML in normal HTML files so they could be highlighted differently would be nice. Currently the scope for both is “text.html.basic”.

Some possible approaches might be detecting whether there are any PHP blocks, looking at the file extension for saved files, and/or remembering if the user manually picked PHP or HTML in the syntax highlighting menu.

So as not to break the existing syntax highlighting themes the scope for HTML in PHP files could be something like “text.html.basic.php” or “text.html.basic.embedded” (though technically it’s the PHP blocks that are embedded in the HTML). Or maybe have a new top level scope like “file.php”, “file.html”, etc. so the overall scope for HTML in PHP files would be “text.html.basic file.php”.

0 Likes

#2

well in themes if I’m not mistaken there is “Embedded Source” which allows you to change the look of embedded code…
I Personally just change the bg to make it distinct enough…


anyways, source.php scope works on PHP files and HTML files with php too…

0 Likes