vscode-cfml icon indicating copy to clipboard operation
vscode-cfml copied to clipboard

Add Support for .cfs Files

Open LionelHolt opened this issue 2 years ago • 3 comments

We can haz support for .cfs files? That is a pure cfscript file analagous to a .js file which is supposed to be supported in the upcoming Lucee 6. We are having a conversation about it in the Lucee Dev Forum.

I added the .cfs extension to the two places in package.json where it looks like it needs to be, underneath the .cfc lines, but the syntax highlighting only works when the code is inside a <cfscript> tag or component {} block. An exception needs to be made for .cfs files so neither of those are required.

LionelHolt avatar Jul 08 '22 10:07 LionelHolt

For what it's worth, you don't need to add it to package.json. That's generally a bad idea to change extension code since it will be overwritten when the extension updates. You can use the VS Code setting files.associations for this purpose.

Example

"files.associations": {
    "*.cfs": "cfml"
}

But this will only accomplish the same thing in a more ideal way. What you really need is a revamp of the syntax file and/or potentially a new language identifier as mentioned in #3. These are big undertakings and I don't know if I can get to that anytime soon.

KamasamaK avatar Jul 08 '22 10:07 KamasamaK

Ah dang I was hoping it would be easy since it's so close to how .cfc files are handled as pure cfscript without requiring a <cfscript> tag. Well, thanks for the tip, and if it makes any difference for this being a higher priority, I discovered that Lucee support for .cfs has actually existed since 2019! With Apache2 and Tomcat config tweaks, I got it working on my laptop. Now just need that syntax highlighting! :wink:

LionelHolt avatar Jul 08 '22 11:07 LionelHolt

I discovered that if the .cfs file begins with a comment (either single-line or multi-line) the syntax highlighting is activated! So that's an easy enough workaround, especially since every good code file should start with comments. :slightly_smiling_face:

LionelHolt avatar Sep 06 '22 20:09 LionelHolt