Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong commenting of code in cached components #60

Open
ghost opened this issue May 19, 2021 · 2 comments
Open

Wrong commenting of code in cached components #60

ghost opened this issue May 19, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented May 19, 2021

It appears that there is a bug where if component is cached then commenting out code with Ctrl-/ creates wrong comment format, this one // instead of this one <!--- --->. I asked this question on SO.

How to reproduce:

  1. Make sure this
"comments": {
    "lineComment": "<!--- --->",
    "blockComment": [ "<!--- ", " --->" ]
}

is added to language-configuration.json file.

  1. Try commenting out code while components are not cached. For me this worked in 2 ways:
    • Create a new .cfc file, quickly add this code:
    <component>
        <cfset a = "a" />
    </component>
    
    and then quickly hit Ctrl-/ shortcut. It should comment out that line of code properly, like so:
    <component>
        <!--- <cfset a = "a" /> --->
    </component>
    
    A few seconds later try commenting out this line of code again - by this time component should probably be cached by extension - hit comment shortcut key again, it should comment out code in wrong fashion, like so:
    <component>
        // <!--- <cfset a = "a" /> --->
    </component>
    
    • Or second option, open some ColdFusion project and while you see "Cachine components" pop-up running in bottom right corner of VS Code try commenting out some code, it should work. After caching is done and pop-up disappears try commenting code, it should not work from now on.

Now, I understand this may not work on other peoples' machines, maybe something is wrong with my setup, maybe I am wrong about what the problem is and where it lies, but that's all I've got right now.

@GeoffCapper
Copy link

I found a similar issue in the Ilich CF module, but the opposite way around. I suspect they may use similar parsing logic under the hood so it might be related.

I write my CFCs in CFScript and the short-cut was commenting using HTML comments when I wanted // comments. It wasn't affecting all CFCs, only one file.

It turned out the issue was a comment in my CFC that included CFML markup:

// <cfset everything = 42>

This was way down in the file but it was enough to trick the parser into thinking the file was CFML rather than CFScript.

@robgermain
Copy link

robgermain commented Feb 27, 2023

@KamasamaK I also am having this issue. Ctrl+\ in a scripted CFC is yielding CFML comments instead of CFScript comments. However, unlike @GeoffCapper, there are no CFM tags in my CFC. When I switched back to to the Illya Verbitskiy CFML extension, I don't have his problem (which is a shame because I like yours better :) ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants