ColdFusion Integration #24

Closed
seanvikoren opened this Issue Jun 28, 2012 · 34 comments

Projects

None yet

5 participants

@seanvikoren

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

Any help will be much appreciated.

@facelessuser
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.

@seanvikoren

Please forgive my ignorance here. I am a recent convert to Sublime Text 2
and I am really hoping to get BracketHilighter working for me.

ColdFusion is (sometimes) a tag based language:
...

Additionally, it can embed css, html, jajvascript, SQL. There is also a
non tag based form of the language that can be mixed in.

After installing the ColdFusion Package via Package Control, I attempted to
get the tags to match by changing a line in BracketHighlighter.sublime-settings
from:

"tag_language_list" : ["HTML","HTML 5","XML","PHP"],

to

"tag_language_list" : ["HTML","HTML 5","XML","PHP","Coldfusion"],

I was unclear on what additional steps I might take next to get the
matching to work and would deeply appreciate any assistance or advice.

Cheers,
Sean

On Thu, Jun 28, 2012 at 1:01 PM, Isaac Muse <
reply@reply.github.com

wrote:

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.


Reply to this email directly or view it on GitHub:

#24 (comment)

Sincerely,
Sean Vikoren http://vikoren.com

702-425-3332
415-671-9645 (cell)

@facelessuser
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.

@seanvikoren

I have attached three files just make sure you get a good set of
examples. They
have not been run, but I have taken care to go over them a few time looking
for bugs and they appear clean.

There is also a possible issue of an html file that has ColdFusion
embedded, though this is not as pressing for me personally.

Cheers,
Sean

On Fri, Jun 29, 2012 at 11:39 AM, Isaac Muse <
reply@reply.github.com

wrote:

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.


Reply to this email directly or view it on GitHub:

#24 (comment)

@facelessuser
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.

@facelessuser
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.

@seanvikoren

Isaac,

My apologies for the delay, here is the gist info:
Description:
ColdFusion Test Files
Public Clone URL: git://gist.github.com/3043063.git Private Clone URL:
git@gist.github.com:3043063.git

And vanilla just in case:
git://gist.github.com/3043063.git

Cheers,
Sean V.

On Tue, Jul 3, 2012 at 9:04 AM, Isaac Muse <
reply@reply.github.com

wrote:

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.


Reply to this email directly or view it on GitHub:

#24 (comment)

Sincerely,
Sean Vikoren http://vikoren.com

702-425-3332
415-671-9645 (cell)

@facelessuser
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.

@facelessuser
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.

@seanvikoren

Isaac,

I thank you for your plug-in and your attention to date.
Once I get to making the list, what is a good way to contact you?

Sean

On Wed, Jul 25, 2012 at 3:49 PM, Isaac Muse <
reply@reply.github.com

wrote:

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.


Reply to this email directly or view it on GitHub:

#24 (comment)

Sincerely,
Sean Vikoren http://vikoren.com

702-425-3332
415-671-9645 (cell)

@facelessuser
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.

@tjahjono

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.

@facelessuser
Owner

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.

@facelessuser
Owner

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.

@facelessuser facelessuser reopened this Sep 17, 2012
@tjahjono

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

@facelessuser
Owner

@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?

@boughtonp

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.)

@facelessuser
Owner

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.

@boughtonp

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.)

@tjahjono

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 :)

@facelessuser
Owner

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 :).

@facelessuser
Owner

@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.

@tjahjono

@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.

@facelessuser
Owner

@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"],
@facelessuser
Owner

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.

@facelessuser
Owner

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.

@tjahjono

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

@tjahjono

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

@facelessuser
Owner

@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?

@facelessuser
Owner

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.

@srconklin

What is the status of this. I am not seeing any bracket highlighting for cfml pages at all

@facelessuser
Owner

I don't know. I am not sure of what you are using for your cfml highlighter, nor do I use cfml. The status is probably as I last posted.

With that said, CFML was probably based on the ColdFusion package here https://packagecontrol.io/packages/ColdFusion, but as you can see, it is only for ST2 (which is when I added this), but it may work with ST3 even though the author did not enable the package for ST3. If you find an ST3 compatible syntax highlighter, you can add support for it via pull request, or lastly, you can modify tag settings to use cfml searches in regular HTML: http://facelessuser.github.io/BracketHighlighter/customize/#tag-plugin-settings.

@srconklin

This is the new cfml package that is regularly maintained for ST3
https://packagecontrol.io/packages/CFML

@facelessuser
Owner

I would test it out and put together a pull request if it works for you. You probably only need to add the syntax file in a couple of places in bh_core-sublime-settings and tag.sublime-settings:

http://facelessuser.github.io/BracketHighlighter/customize/#tag-plugin-settings

http://facelessuser.github.io/BracketHighlighter/customize/#configuring-brackets

I leave language support up to the community: http://facelessuser.github.io/BracketHighlighter/contributing/.

I mainly support the core code, though if you get stuck, I don't mind offering advice or answering questions to help you get your pull request moving forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment