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

Function Hints #42

Open
pfreitag opened this issue Jul 28, 2021 · 4 comments
Open

Function Hints #42

pfreitag opened this issue Jul 28, 2021 · 4 comments

Comments

@pfreitag
Copy link
Member

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
Copy link

KamasamaK commented Jul 28, 2021

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
Copy link
Member Author

@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
Copy link

KamasamaK commented Jul 28, 2021

@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
Copy link

JamoCA commented Nov 9, 2021

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.

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

No branches or pull requests

3 participants