4

I write ColdFusion in VS code and have KamasamaK's CF extension installed. When I am inside a .cfc file and when I hit shortcut key - Ctrl-/ - it comments out code in a wrong fassion, like so:

// <cfset cfc = "wrong comment format" />

Now, I already followed instructions in this answer and have this written inside of my

C:\Users\<username>\.vscode\extensions\kamasamak.vscode-cfml-0.5.3\language-configuration.json file:

"comments": {
    "lineComment": "<!--- --->",
    "blockComment": [ "<!--- ", " --->" ]
}

and when I hit shortcut key inside of my .cfm file it works great:

<!--- <cfset cfm = "it works in cfm file" /> --->

but for some reason it does not work in .cfc file.

Additional information:

  1. My .cfc file is recognized as ColdFusion file (I see CFML written in the bottom right corner of the VS Code).
  2. When I close and reopen VS Code I see notification in the bottom right corner "Caching components". While this caching in progress commenting does work correctly and I was able to comment code out correctly like so:
<!--- // <cfset cfc = "wrong comment format" />  --->

however, after caching is done it is back to commenting out code in the wrong fashion, like so:

// <!--- // <cfset cfc = "wrong comment format" />  --->
  1. I tested it with every single other extension disabled.

Questions:

  • Anybody knows what could be wrong?
  • Could this be a bug in the extension itself?

Edit 1.

Yesterday I left this comment:

[...] I created basic component, 3 lines of code, and formatting worked! Thank you. Need to analyze my code now.

However, this morning I tried to create the exact same basic .cfc again but this time it did not work, unlike yesterday:

<component>
    // <cfset a = "a" />
</component>

Not sure what is going on, but since it works while "Caching components" pop-up is running I think the answer lies somewhere there.

Edit 2.

I just tried to create basic component for the 3rd time to test comment feature again. Immediately after I finished typing out this code

<component>
    <cfset a = "a" />
</component>

I hit comment shortcut key and commenting worked:

<component>
    <!--- <cfset a = "a" /> --->
</component>

However, after about 1 second later or less, I hit shortcut key again and it again commented out code wrongly:

<component>
    // <!--- <cfset a = "a" /> --->
</component>

I suspect that this new file got cached and correct .cfc commenting stopped working. So, it looks like there might be a bug in extension where cached components comment code in wrong fashion.

Edit 3.

I created this issue in GitHub based on my best understanding of the problem.

0 Answers0