0

I have been trying to use JSDOC comments in my smart contract files (as many contracts already have), but my VS Code seems to be not picking up the structure using the usual commant of /** */

Although, the comments are working fine in the test files which are .ts. Any idea how can I do it?

Sample Comments Requirement:

/**
 * @param a
 * @param b
 * @returns
 */

1 Answer 1

0

Doc for Solidity is a bit different -

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
     function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private { ... }

Another example with returns -

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { ... }
2
  • Yes, they are different. But I am still unable to use them in my contracts without copying. Any way I can use them? May 4 at 4:49
  • VS Code doesn't have a built in support, but there may be plugins that provide docs comment template.
    – Kof
    May 4 at 5:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.