This relates to the style of contract comments.
I'm trying to create a multi-line comment that has an asterisk at the beginning of each line, as is done in the OZ contracts:
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overridden in child contracts.
*/
I'm using Visual Studio Code, and I create a comment block using /** */, but the contents don't have the asterisk at the beginning of each line.
Is there a way to configure VS Code to produce this style?
Hey @onionpeel I found this extension in VC that meets what you were looking for.
Verify that the multi comment check is activated, it came to me by default activated.
I hope it has been helpful to you.
Thanks! That's what I'm looking for. Unfortunately, Solidity is not listed among the supported languages. I tried it just to know for sure, but it didn't work.
There is probably an easy fix somewhere that I just haven't found yet. I'll keep digging.
Are you sure?
Before sending it to you, I tested it myself for solidity.
To activate it start with /**
And it should be activated there. You give it enter and the line break starts with an asterisk
1 Like
This is strange. I installed Better Comments, and it allows for the formatting we're talking about in TypeScript but not Solidity.
In Solidity when I type /** and hit enter, it just creates a closing */, but the new lines never start with the asterisk like you show.
Would you mind disabling Better Comments and trying to do a comment? I'm curious to know if there might be something else that is allowing you to get that formatting in Solidity.
I have done it, and you are right, it applied to me the same, I suspect it could be the Solidity + Hardhat Nomic Foundation extension, I tried to see the documentation to see if they implemented it, but I don't know what other extension could be.
2 Likes
Thanks so much!!!
I had been using the Solidity extension by Juan Blanco, so I switched to the Hardhat extension, and it works. I appreciate your help.
2 Likes