Closed ericyd closed 5 years ago
added:
.tmp
files generated from Grunt task and re-write to /resources
functions.json
has a few modificationscf
from prefixes. I think prefixing every tag with cf
is one of the absolute worst elements of the language and having to access snippets that way is barely any better than just typing the full tagname.I think prefixing every tag with cf is one of the absolute worst elements of the language and having to access snippets that way is barely any better than just typing the full tagname. CF used to be purely tag based. It was an easy way to graduate from HTML to a dynamic language. So all tags start with "CF...". That differentiates
<form>
from<cfform>
so that the cfml parser knows where to process tags and which are just static html tags. With your prefixes removed, are there issues withinput
vscfinput
(etc)?
Well yes I agree it is a debatable position but I would argue that the time has passed where CF-specific UI tags are beneficial to web development.
As for compatibility: my update only changes the snippet prefix, which is the part it uses to identify when to suggest/insert a snippet. It doesn't change the snippets themselves. Below, I demonstrate typing form
, then selecting the snippet which inserts cfform
.
Of course, you could always just type <form>
in a .cfm
page to get a normal HTML form element.
I think this is a much more usable snippet syntax. However, if this proves an unpopular decision I could roll back that one commit.
It's just my opinion... this would totally goof up my workflow. Too many html elements have cf counterparts. form, input, select, table... This makes us have to remember all those counterparts, and have to manually type the html elements that are a counterpart, and know the opposite for when wanting a cfml tag. Take my comments with a grain of salt. I don't use VSC because the CFML support is lacking in general. I'm waiting for a complete rewrite of it. CFML in Sublime Text 3 is much better so that is where I work, though I'd prefer to use VSC.
That's valid, though I do have a follow up question: do you use HTML snippets in your .cfm
or .cfc
files? If so, how? (I want to know!)
When I'm working in a .cf*
file, I have the snippets from this extension enabled. If I'm working in html, my html snippets are enabled. But as far as I know, there is no way for a cf file to cross-reference html snippets in an easy way. (I'm sure I could do a lot of manual work, but...) Therefore, when I'm working in CF world, I want the quickest way of accessing CF tags. If I want HTML tags I type manually.
I would imagine this falls into the category of "reasons not to use vscode for cf development" but just curious.
EDIT: I spoke too soon, looks like this is quite easy to do with emmet settings. In user settings:
"emmet.includeLanguages": {"cfml": "html"},
Then form
looks like this and you can pick which one you want, HTML or CF. Still debatable if this would be preferable to most users.
I use cfml tags almost exclusively, mixed with HTML. Not much script. I learned CFML in 1998, so I'm probably pretty old school with it.
I'm not really sure what kind of example you're looking for. But something like this comes to mind. CFINPUT and plain SELECT in the same CFFORM:
<cfform ...>
<div class="row-fluid">
<div class="span4">
<div class="control-group">
<label for="textfield" class="control-label">Type</label>
<select name="dType" id="dType" class='uniform-me'>
<option value="Non-Insulated" <cfif read.dType eq 'Non-Insulated'>selected</cfif>>Non-Insulated</option>
<option value="Insulated" <cfif read.dType eq 'Insulated'>selected</cfif>>Insulated</option>
<option value="Wood" <cfif read.dType eq 'Wood'>selected</cfif>>Wood</option>
<option value="Steel with Vinyl Overlays" <cfif read.dType eq 'Steel with Vinyl Overlays'>selected</cfif>>Steel with Vinyl Overlays</option>
<option value="Wood Composite" <cfif read.dType eq 'Wood Composite'>selected</cfif>>Wood Composite</option>
</select>
</div>
</div>
<div class="span4">
<div class="control-group">
<label for="textfield" class="control-label">Order By</label>
<div class="controls controls-row">
<cfinput type="number" value="#numberformat(read.orderby, 0000000)#" name="orderBy" required="yes" message="Enter an order in whole numbers" validate="numeric" class="span12">
</div>
</div>
</div>
</div>
</cfform>
I found a better way to do this by adding filterText
to the CompletionItem returned from the snippet provider.
It works the same but results in this in the suggestions list
added detail
to CompletionItems. Makes snippets show the tag at the top
added actual code it will insert to the snippet documentation
@ilich any opinions on the filterText addition? I'd be happy to remove if it makes this update more palatable.
JSON.stringify
supports formatting options.
@KamasamaK good call, updated
Year old PRs should be closed 😄
Tag snippets currently contain two spaces between tag name and params. I think it would be better to only have one space.
I updated the
Gruntfile
andtags.json
. Used JSON.stringify for formatting.