jcberquist / sublimetext-cfml

CFML (ColdFusion and Lucee) package for Sublime Text
MIT License
115 stars 24 forks source link

No syntax highlighting for CSS or JavaScript in cfoutput block #101

Open KamasamaK opened 6 years ago

KamasamaK commented 6 years ago

A <cfoutput> block within a <script> or <style> block loses syntax highlighting.

Example: sublimetext-syntax-javascript-cfoutput

jcberquist commented 6 years ago

Thanks @KamasamaK, I have been waiting for someone to raise this issue since I first put the package up 😀 . Perhaps I should have put it into a known issues section.

This is a (side) effect of the way I chose to implement the <cfoutput> tag. I wanted to distinguish between # characters inside and outside of <cfoutput> blocks, but the side effect of this is that inside of <cfoutput> blocks the scoping context goes back to the base HTML context. This works in most cases (for me, at least) and I decided I would live with this issue in order to retain the ability to distinguish # uses inside and outside of <cfoutput>.

In the past I would have just left it here, as I think the only solution for improving it is a custom HTML syntax that I would have to include in the package. I was not eager to maintain my own version of the HTML syntax. But it might be a lot easier to do that now, by using @Thom1729's YAML-Macros package to extend the base HTML syntax without having to create or maintain an entire syntax file. I am already using his package to build a separate CFScript syntax for when script is used in <cfset> tags and the like. I will take a look at that when I have some time.