foundeo / toscript

Converts Tag based CFML to CFML Script
GNU General Public License v3.0
20 stars 9 forks source link

Function Hints #42

Open pfreitag opened 3 years ago

pfreitag commented 3 years ago

Currently the function hint attribute is moved to a comment above the function. Both Lucee and ACF prefer that it is in a function argument instead (Which show up in the meta data when you dump the function).

<cffunction name="test" hint="Hint">
    <cfreturn 1>
</cffunction>

Should become:

function test() hint="Hint" {
    return 1;
} 
KamasamaK commented 3 years ago

I've always preferred it in the docblock for script. Can you clarify what you mean by the engines preferring it via an attribute? I just tested on TryCF and dumping the function directly: ACF displays the docblock text as the hint back to at least CF10 and Lucee 5 shows the hint under the source GUID in all cases. Dumping the result of getMetadata(): Both get the hint either way.

Test: https://trycf.com/gist/fcf6d216f21c10c7d7976897592f6860/acf?theme=monokai

pfreitag commented 3 years ago

@KamasamaK ah, I made a silly mistake when testing this, I was using this:

/*
 * testHint
 */
function test() {
    return 1;
}

Which wasn't showing the hint. If you use /** two asterisks to start the comment then it doesn't show up in the metadata.

Sounds like this would have to be option, as I also prefer it in the comment block.

KamasamaK commented 3 years ago

@pfreitag That makes sense now. I was about to say in my other post that a docblock is not just a comment, since that's the word you used, but I thought you might have just misspoke.

JamoCA commented 2 years ago

Are there any plans to add the hint parameter? perhaps add it as an option so that developers that prefer docblock can continue with the way that it currently functions.