davejlong / cf-utils.vim

A new Vim plugin to make Vim into a full-blown CFML and CFScript IDE
20 stars 10 forks source link

Syntax: nested strings in cfHashRegion #8

Open Tomalak opened 10 years ago

Tomalak commented 10 years ago

In syntax/cfml.vim you ask "Which is better?", and clearly the commented-out version is.

With structures like these it breaks:

<cfquery>
  SQL syntax here...
  <cfqueryparam value="#Replace(value, "foo", "bar")#">
  more SQL syntax here...
</cfquery>

In the syn match the string started by value=" version bleeds over the end of the <cfqueryparam> and messes up much of the rest of the file. (You can see that GitHub's CFML highlighting messes this up in a similar way.)

The syn region version does a much better job here. Not sure if adding a keepend improves things (maybe performance-wise?) - anyway, it does not seem to make it worse.

Your thoughts?

davejlong commented 10 years ago

Your comment makes sense. I'd encourage to open a pull request with some screen shots of the different implementations. I'm not doing much CFML development these days, so I'm sad to say that this repo is falling behind.

Tomalak commented 10 years ago

Sad to hear you've more or less abandoned this. I do quite a bit of CF development but I don't know enough about vim script (and syntax definitions in particular) to confidently take over the repo. :/

Note that <cfquery> and some other tags (<cfmail> for example) behave like <cfoutput> is enabled, so hash regions should be properly highlighted inside. That's currently not working either. As soon as I've figured this out I'll send you a pull request.

davejlong commented 10 years ago

What you’ll probably want to look at is the containedin attribute of the cfHashRegion match and the cfOutputRegion. Can’t remember if you can pass a list to the containedin attribute or not.

You could also modify the cfOutputRegion regular expressions to match cfoutput, cfmail and cfquery.


As sad as it is to move away from my first love in the programming world, I'm enjoying working with other languages very much (specifically a big focus on Ruby and JavaScript).