Skip to content
This repository

ColdFusion Integration #24

Closed
seanvikoren opened this Issue June 28, 2012 · 30 comments

4 participants

Sean Vikoren Isaac Muse RHPT Peter Boughton
Sean Vikoren

Greetings, I am hoping to get BracketHighlighter running well with https://github.com/SublimeText/ColdFusion.

Any help will be much appreciated.

Isaac Muse
Owner

You will have to be very specific and explain what is not working or what you would like working with said ColdFusion.

I do not code with ColdFusion, so I am unfamiliar with what you are wanting.

Sean Vikoren
Isaac Muse
Owner

Can you provide me with an example Coldfusion script file.

There are a couple of things I must check. I will install the ColdFusion plugin, and attempt to enable BracketHighlighter for ColdFusion, and using the script you provide, I will verify that the BracketHighlighter can recognize ColdFusion tags properly (I am not sure if there will be issues).

If there are issues, I will look into fixing them. If there are no issues, I will give you steps to enable BracketHighlighter with ColdFusion.

Sean Vikoren
Isaac Muse
Owner

I am not sure where the attachments are. Can you create a gist? or put them on pastebin or something?

No worries about running. I don't plan on running them. I just want to make sure BH works when editing them.

Isaac Muse
Owner

I would really like to help with this, but without legitimate test files, I will have to close this issue. Since I do not use ColdFusion I need accurate files using ColdFusion's syntax so I can see what possible issues there are.

I will be closing this by the end of the week if I am not able to get some ColdFusion test files. If at some point after that you are able to provide some test files, we can reopen the issue.

Sean Vikoren
Isaac Muse
Owner
    "angle_language_list" : ["HTML","HTML 5","XML","PHP", "ColdFusion", "ColdFusionCFC"],
    "tag_language_list"   : ["HTML","HTML 5","XML","PHP", "ColdFusion", "ColdFusionCFC"],

This should get ColdFusion mostly working. BracketHighlighter will not recognize ColdFusion self closing tags currently.

So for instance this will not work

<cfinvoke 
         component = "Images" 
         method="ImageFlipper" 
         returnvariable="imgpath" 
         directory="Images/Runners">

But if you explicitly close it with a slash, it will:

<cfinvoke 
         component = "Images" 
         method="ImageFlipper" 
         returnvariable="imgpath" 
         directory="Images/Runners"/>

If you can provide me with a list of cold fusion tags that optionally self close (don't need a closing tag in certain circumstances), I can maybe add a more official support.

Isaac Muse
Owner

I am closing this. If I get around to figuring which Coldfusion tags are self closing, or if someone provides a list, I will look into adding more appropriate Coldfusion tag support.

Isaac Muse facelessuser closed this July 25, 2012
Sean Vikoren
Isaac Muse
Owner

Cool.

You can probably just put the list up in gist and provide a link here. Thanks for putting in the effort here, I am sure others will appreciate it. I don't personally use Coldfusion, but I know there are others that do.

Thanks.

RHPT

Here's a list of all the tags in ColdFusion 9. I konw you wanted a list of only self-closing tags, but probably about 60-75% of these tags are self-closing.

Isaac Muse

I don't see a list, can you put them on a gist or something? Also, I will need to know which ones are actually allowed to be self-closing. They are handled differently to make sure they get highlighted when in self closing state. If a non self closing tag is written as a self closing, Bracket Highlighter should not highlight them because they are not valid. That is why I need the distinction between the two.

Also, thanks. I am sure a lot of ColdFusion people will be grateful for your efforts.

Isaac Muse

Looks like I am making some good progress with ColdFusion support.

Sadly, I am not getting much follow through from ColdFusion users...I don't use ColdFusion, so it would be nice to get some help on this. I won't be using this...

Anyways, I got a list of self-closing ColdFusion tags here: http://www.webveteran.com/blog/web-coding/coldfusion/coldfusion-tag-usage-syntax/

I don't know how accurate this is. Basically, I am looking at the left column and making all of those optionally self-closing. If this list is inaccurate, please correct me now. Also, something that would be nice is to identify tags that never use closing tags (if there are any in ColdFusion).

I am also adding the ability for BracketHighlighter to detect optionally self-closing tags in general. This will be useful because it appears a lot of ColdFusion users do not end there self-closing tags like this <sometag/> but many use the more ambiguos style of <sometag>.

If you are a ColdFusion user and would like to test this out and give feedback before I push it out, please do let me know. Again, this is for you, not me.

Isaac Muse facelessuser reopened this September 16, 2012
RHPT

That page is a nice find! I tried googling for the information but couldn't find anything, and I was trying to give you a list without having to go and document every tag.

Briefly looking over the list, it does look accurate. In my experience, some tags, like <cfset>, are never closed, even though it wouldn't thrown an error if it had a self-closing tag. Others can either be self-closing or require a closing tag, depending on usage, such as <cfhttp>. Making all the tags on the left optionally self-closing is a good and probably the best way to cover everything.

The problem is that ColdFusion has soooo many tags (and I won't mention custom tags), and only a percentage of them are used regularly. Nevertheless, I've put out a clarion call for other CF devs over at StackOverflow to assist in this task (http://stackoverflow.com/questions/12452831/self-closing-coldfusion-tags). (However, I have a feeling the question will be closed)

Off the top of my head, the tags below are never self-closing. I'll do my best to go through the CF tags list and find more.

<cfoutput>
<cfif><cfelseif><cfelse>
<cfquery>
<cfloop>
<cfswitch><cfcase><cfdefaultcase>
<cftry><cfcatch>

And if you want to see a list of every CF tag, check out this page http://cfquickdocs.com/cf9/#cat:categories:All

Isaac Muse

@rhpt
Thanks! I think what I will do is try to expose some of this stuff in the settings file so, if what I do isn't quite right, people can tweak it.

Custom tags seem like they could be trouble which leads me to think exposing this in the settings file is the way to go. I don't even know what custom tags are :). I imagine if I can allow people to add custom tags in a settings file, that might do. If everyone used the <sometag/> notation this would be a non-issue, but in order to catch these ambiguous tags <sometag>, I will have to require a list of expected self-closing. I guess the other alternative is to treat all ColdFusion tags as possible self-closing. That would make it harder to catch mistakes with tags in the code because BracketHighlighter would skip right over those kinds of errors.

The good news is that I have some rough code that works on an example CF code someone gave me, so I am at least heading in a good direction.

I am oblivious to ColdFusion, so having someone who knows about this stuff is helpful. Thanks again.

When I get a less rough branch together, can you do some testing with it and give me feedback?

Peter Boughton

CFEclipse dictionaries specify if tags must/can/cannot be closed:
https://github.com/cfeclipse/cfeclipse/tree/master/org.cfeclipse.cfml/dictionary

Note that alongside the different CF versions - cf7, cf8, cf9, cf10 - there is also Railo and OpenBD which have extra tags.
Nothing contradictary (in terms of closing tags), but depending on what kind of info you're storing, there's extra tags (e.g. cfwhile in Railo, which acts the same as cfif/cfloop), which may need to be catered for appropriately.

Custom tags (either called directly with <cf_tagname... or via <cfmodule template="tagname.cfm"...) have behaviour which can vary, so the simplest action is to allow but not require self-closing for any custom tag.

Of course, there are also custom tags imported via cfimport which have custom prefixes and must always be closed.
(It's also possible to override HTML tags by having a blank prefix, but fortunately I don't think that's common behaviour, and if anyone does do it, most shouldn't expect an editor to handle it.)

Isaac Muse

I see. Ugh...I am going to have to write a script to extract the info I need, but thanks for the link; this will be very helpful.

I am glad to here that custom tags have a predictable pattern, this will make things easier for me. I agree, allowing self closing and not requiring them seems to be safest for custom. BH already supports explicit self-closing </>, so I am good there. Hopefully, the experimental self-closing detection I plan on adding will be sufficient to catch all of these pesky non-explicit self-closing.

I can see CF support is going to be a big headache, I appreciate the info provided thus far, it is definitely helping.

Peter Boughton

Heh, if you think this is bad, try writing a full parser for it. ;) But yeah, the flexibility of CFML is great when working with it, and a huge PITA when writing tools to handle it.

Oh, and just to clarify in case the distinction hasn't been made yet:
CFML = the language
ColdFusion = the Adobe product.

(A lot of developers say "CF" or "ColdFusion" when they're actually referring to the CFML language, so it's useful to be aware what they may or not be referring to.)

RHPT

To keep it manageable, I'm not sure @facelessuser should worry about Railo and OpenBD specific tags. Also, I wonder if BracketHighligther can just look for any tags that start with <cf to flag whether or not it's a CFML tag and then make the forward closing tag optional. This would take care of custom tags. As for <cfimport> tags, it could just look for what's in the prefix attribute, and match those tags.

Oh, and I will also help test when it's ready :)

Isaac Muse

Also, I wonder if BracketHighligther can just look for any tags that start with <cf to flag whether or not it's a CFML tag and then make the forward closing tag optional.

That is certainly a possibility. I can roll out a branch for testing with that and see if people find it sufficient. If not, I can add more specific functionality.

@rhpt I will let you know when I have a branch up. It should be up sometime this week. It all depends how lazy I am :).

Isaac Muse

@rhpt I actually got around to it tonight. The branch is here: https://github.com/facelessuser/BracketHighlighter/tree/SelfClosing-and-CFML

Just add "detect_self_closing_tags": true, to your User/BracketHighlighter.sublime-settings file and set the following setting to this: "tag_type" : "cfml",.

Let me know how it works for you. Thanks.

RHPT

@facelessuser I updated BracketHighlighter.sublime-settings, Elements.py, and BracketHighlighter.py, but now it doesn't highlight any cfml. I also edited User\BracketHighlighter.sublime-settings, prt yout instructions.

Isaac Muse

@rhpt
Sorry, you need to add the ColdFusion plugin's syntax in the BracketHighlighter settings below (It is assumed you have the ColdFusion Plugin installed):

"angle_language_list" : ["HTML","HTML 5","XML","PHP", "ColdFusion", "ColdFusionCFC"],
"tag_language_list"   : ["HTML","HTML 5","XML","PHP", "ColdFusion", "ColdFusionCFC"],
Isaac Muse

Also, you might need to restart ST2 after update? I don't know, but it was working for me, let me know if you are still having trouble after trying my above additions.

Isaac Muse

Definitely restart ST2 after upgrading to the new branch. The changes are significant enough and buried in the dependencies, so a restart is needed to re-include the dependencies proper. Just tried it on my Windows Computer at work, and it works fine if you follow the settings instructions and then restart ST2.

RHPT

I had just replaced the files that were updated. I downloaded the project and re-installed, and that worked. Testing it out now.

RHPT

Worked with it for a couple of days now. Looking good so far!

Isaac Muse

@rhpt Great. I may go ahead and merge these changes into the mainline defaulted to off, and let people play around with it. I was mainly concerned about the cfif and cfelseif tags; they didn't follow normal tag conditions, but it seems you haven't run into any issues with that yet.

One thing though:
I also noticed that cfml attributes can use dot notation somevalue.somemember="some value". Tags names can't do this as well in cfml can they?

Isaac Muse

I am counting this closed. Experimental CFML support is on the main branch. Read the readme for more info. If there are issues with CFML support, open up a new issues to have those resolved.

Isaac Muse facelessuser closed this September 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.