Tapatalk

How to create smart language template for ColdFusion?

How to create smart language template for ColdFusion?

23
Basic UserBasic User
23

    Jul 20, 2017#1

    How do you create new custom language templates?

    I use ColdFusion (CFML) and noticed that there's no dedicated smart template list. I tried to make one by cloning the empty (default) "batch-tpl.xml" language template (to "cfml-tpl.xml" and "coldfusion-tpl.xml", restarted UE and still don't see it in the "template list". (I've enabled "show all languages" and see CSS, HTML, Java, JavaScript, JSON & XML.)

    I also reinstalled "ColdFusion" wordfile (ColdFusion_SQL), but it's pretty outdated and made my own "ColdFusion" wordfile that I'm expanding to work with CFCs and new CFML syntax that has been added since 2012 (the last version of the default UE wordfile.)

    Is there a good resource to learn "how to create a custom UltraEdit language template" w/rules regarding the syntax, etc. Is there some sort of flag in the wordfile that enables language-specific smart templates?

    I'm creating this template because there are smart templates that I want to create, but only have them display if I'm specifically editing ColdFusion. (I'm currently adding code fragments to the "global" template list and this is not ideal.)

    Thanks.

    6,685587
    Grand MasterGrand Master
    6,685587

      Jul 20, 2017#2

      There is absolutely no need to copy/create template files manually and edit them in UltraEdit although that is possible because template files are XML files.
      1. Click with secondary (right) mouse button into the Template List view in free area to open its context menu containing the menu item Modify Templates. This opens the Modify Templates dialog window.
      2. Select at top right corner of the Modify Templates dialog window the syntax highlighting language respectively language template to create or modify.
      3. Press on + below the Templates list, enter name for the template, and enter next template content and perhaps also a description, and perhaps check one or both options for this template.
      4. Redo the third step as often as needed to define all templates.
      The button Help at bottom right corner of Modify Templates dialog window opens the appropriate help page for this dialog explaining the format and options for tag contents.

      The dialog is a modeless dialog which means it is possible to access also for example the document window below to select there text to copy and paste into tag Content field.

      If configuration setting Disable drag & drop is not checked at Advanced - Settings or Configuration - Editor - Miscellaneous it is even possible to select a text snippet in current file and drag & drop the selected text into the template view to create a new template with a name to enter next with the selected text as template content. It depends on where the selected text is dropped in the template view if a global, a layout or a language template is created.

      Please note that the context menu of template view depends on where exactly the secondary mouse button click is executed: on free area, on a template group name, or on a specific template.

      See forum topic Smart templates management for detailed information about template files management.
      Best regards from an UC/UE/UES for Windows user from Austria

      23
      Basic UserBasic User
      23

        Jul 20, 2017#3

        Okay ... but what if the language I want to create a smart template for "is not listed" in step #2?

        The existing "ColdFusion" syntax wordfile is bad/outdated. I've already encountered issues where changes that I made were overwritten and I'd prefer for that to not happen again. I created a separate "coldfusion.uew" wordfile and works fine for color syntax and tag completion, but I do not see "coldfusion" or "cfml" as a language choice when editing templates.

        Please try adding "ColdFusion" as a language and let me know if you see "ColdFusion" as one of the smart template group options.

        115
        Power UserPower User
        115

          Jul 20, 2017#4

          One thing that Mofi did not mention (perhaps because it is so obvious) is that you need to have a file in the language you want to write templates for open as the active tag and that file is recognized by syntax highlighting.

          For instance, I have a half dozen programs open in my UltraEdit session right now. Most are Python, but I have a text config file and an IDL file open too. When I look at the Template List while the active tab contains a Python program, I have Global, Balanced, and Python as choices, with a lot of Python templates available. If the config file tab is active, I have only Global and Balanced, since I do not have a syntax highlighting file for text. If I have the IDL program tab as active, I have Global, Balanced, and IDL choices but there are no IDL templates since I haven't chosen to make any.

          23
          Basic UserBasic User
          23

            Jul 20, 2017#5

            On another note, if I have a text file with a "CFM" extension open in the editor and select the following menu option, UltraEdit crashes.

            Coding | Tools | Code Template (drop down)

            If I edit a "CSS" file, clicking the same drop-down is fine (as well as clicking the top of the button which isn't the drop down.)

              Jul 20, 2017#6

              @MickRC3

              I have "ColdFusion" listed at the bottom as the language AND the syntax color coding is working.

              Please enable "ColdFusion" as a language. Create an empty text file with a "CFM" extension and see if your experience is any different. There's no "ColdFusion" option for me and accessing the quick menu from the navigation crashes UE.

                Jul 20, 2017#7

                Here's a screenshot of my environment. The wordfile is identified & being used. The syntax is correct... but there's no "ColdFusion" or CFML" language options to use when generating Smart Templates.
                UE_MissingCFML_20170720143204.png (90.38KiB)

                115
                Power UserPower User
                115

                  Jul 20, 2017#8

                  I have UE 21.20 at work and UE 23 at home. I can only do this sort of testing at home. What version are you using? Looks like it is 24x? And submit your ColdFusion wordfile (with a name that does not conflict with the old ColdFusion wordfile) to the wordfile repository so I can try it.

                  23
                  Basic UserBasic User
                  23

                    Jul 20, 2017#9

                    it looks like the default "coldfusion_sql.uew" wordfile that is available directly from UltraEdit is outdated.
                    https://www.ultraedit.com/resources/wf/ ... on_sql.uew

                    There's a new "ColdFusion8" wordfile (which is still outdate), but this seems to have been updated and is displayed as a smart template language group.
                    https://www.ultraedit.com/resources/wf/coldfusion8.uew

                    is there any way to determine version and/or compatibility of the "uew" wordfiles? I'm not sure what's wrong with the default ColdFusion file (which is displayed & downloaded via the admin menu.)

                    I think I'll start over... with the "coldfusion8" wordfile as by base and continue adding support from there.

                    6,685587
                    Grand MasterGrand Master
                    6,685587

                      Jul 21, 2017#10

                      The wordfiles on wordfiles download page which can be also downloaded and uploaded via GitHub and installed since UltraEdit v24.00 directly from within UltraEdit are user-submitted without any verification by IDM. Unfortunately this means many of the wordfiles contains lots of mistakes in language definition and some are so badly written that they can't be used for creation of smart language templates.

                      I quickly looked on all user-submitted ColdFusion wordfiles and they are all full of mistakes. Please compress your wordfile into a ZIP or RAR archive file and upload the archive file as attachment to your next post. I will look into it and fix all errors in the wordfile. Then it should be no problem to create the smart language templates file. On weekend I will look also on all other user-submitted ColdFusion wordfiles and fix all the errors to avoid that in future other users of UE/UES using them have the same problems as you.

                      It could be that I need your ColdFusion language knowledge for fixing all errors in the ColdFusion wordfiles because I know nothing about ColdFusion. I hope you help me when I stuck on a problem which I can't solve without knowledge of ColdFusion language.

                      Update on 2017-07-23:

                      I have attached the revised user-submitted ColdFusion wordfiles.

                      The most interesting one for me was the most likely oldest one coldfusion431.uew which contained the keyword Nocase twice and having no language name (very bad for many reasons nowadays).

                      I updated my macro SortLanguage to automatically remove Nocase duplicates from first line of a language file and handle languages without name by adding "Language Number" whereby the number is taken from the beginning of the language definition line. The later modification of my macro was really important as the language without name resulted on this wordfile with last color group also modified in an endless running loop near end of macro execution which needed to be broken by me with hitting key ESC. The updated macro SortLanguage is not yet published.

                      Most of the changes made on the files where done by my syntax tools macros.

                      I'm not sure if the changes made by me on function strings in coldfusion_sql.uew result in a better function list. I hope so, but I really don't know which strings should be matched and which ones ignored by the original UltraEdit regular expressions and which part of each matched string should be displayed in function list. Jamo, please let me know anything you can tell me about the function strings and what they should find and display in function list.

                      Later when having them perhaps further improved with your help I will send them IDM for upload on their server replacing the existing ones.
                      coldfusion_wordfiles.zip (27.53 KiB)   55
                      Revised user-submitted wordfiles for ColdFusion
                      Best regards from an UC/UE/UES for Windows user from Austria

                      23
                      Basic UserBasic User
                      23

                        Jul 24, 2017#11

                        Thanks. I'll take a look at the modified wordfile.

                        [separate issue, but potentially related to wordfiles] Regarding auto-closing tags, I noticed that HTML's BR and INPUT tags don't auto-generate the end tag. (ie, "<br></br>") There are many CFML tags that are similar and can cause problems if they are added (ie, most custom tags).

                        What's the best way to add tags to an "ignore/don't auto-close" list? (and is this documented anywhere?) Is this control in the wordfiles? If so, I haven't been able to figure it out by viewing the HTML & XML files.

                        6,685587
                        Grand MasterGrand Master
                        6,685587

                          Jul 24, 2017#12

                          It is hard coded in source code of UltraEdit/UEStudio which tags in a section syntax highlighted with a language having language marker keyword HTML_LANG have no end tag according to HTML standards. So automatic closing of tags is not customizable. And a tag of an empty element which ends with /> is of course also not automatically closed.

                          It is only customizable which tags are displayed: opening tags without tags like <p>, opening tags without or with attributes like <p style="color:red">, opening tags which require at least one attribute like <a (<a> is missing in wordfile) and end tags like </p> if the element has one (otherwise missing in wordfile).
                          Best regards from an UC/UE/UES for Windows user from Austria

                          23
                          Basic UserBasic User
                          23

                            Jul 24, 2017#13

                            ok... I didn't realize that. I thought it may have been a setting somewhere that I could find.

                            There are many ColdFusion (CFML) tags that do not require closing tags. Closing some of them can actually cause data loss or internal server errors. For example, the following CFML tags are prohibited from having end tags.
                            • abort
                              applet
                              application
                              argument
                              associate
                              authenticate
                              break
                              chartdata
                              col
                              collection
                              continue
                              cookie
                              dbinfo
                              directory
                              else
                              elseif
                              error
                              exit
                              feed
                              flush
                              forward
                              ftp
                              graphdata
                              header
                              httpparam
                              image
                              imap
                              import
                              include
                              index
                              input
                              insert
                              invokeargument
                              ldap
                              location
                              log
                              loginuser
                              logout
                              mailparam
                              object
                              objectcache
                              param
                              pdfparam
                              pop
                              procparam
                              procresult
                              property
                              queryparam
                              registry
                              rethrow
                              retry
                              return
                              schedule
                              search
                              servlet
                              servletparam
                              set
                              sleep
                              slider
                              throw
                              update
                              video
                              videoplayerparam
                              wddx
                              x_
                              zipparam
                            Here are some related articles:
                            http://code.rawlinson.us/2015/11/closin ... usion.html
                            http://cfbestpractices.blogspot.com/201 ... empty.html
                            https://stackoverflow.com/a/7544785/693068
                            https://github.com/SublimeText/ColdFusion/issues/149