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

C语言的函数返回值无法识别 #612

Open
xtzhu666 opened this issue Jul 19, 2024 · 0 comments
Open

C语言的函数返回值无法识别 #612

xtzhu666 opened this issue Jul 19, 2024 · 0 comments

Comments

@xtzhu666
Copy link

描述bug(必填)

使用快捷键自动添加注释,返回值的类型无法识别添加到注释中,只能显示一个*号。

注释设置(必填):

VsCode设置:

"fileheader.configObj": {
        
        "createFileTime": true,
        "language": {
            "c": {
                "head": "/********************************************************************** ", // 统一增加几个*号
                "middle": " * @",
                "end": " **********************************************************************/",
                "functionParams": "c", // 使用C语言解析函数参数
                "functionSymbol": {
                    "head": "/********************************************************************** ", // 统一增加几个*号
                    "middle": " * @",
                    "end": " **********************************************************************/"
                }
            },
           "h/hpp/cpp": {
                "head": "/********************************************************************** ", // 统一增加几个*号
                "middle": " * @",
                "end": " **********************************************************************/",
                "functionParams": "cpp", // 使用C++语言解析函数参数
                "functionSymbol": {
                    "head": "/********************************************************************** ", // 统一增加几个*号
                    "middle": " * @",
                    "end": " **********************************************************************/"
                }
            }
        },
        "autoAdd": false,
        "autoAddLine": 1000,
        "autoAlready": true,
        "annotationStr": {
            "head": "/*",
            "middle": " * @",
            "end": " */",
            "use": false
        },
        "headInsertLine": {
            "php": 2,
            "sh": 2
        },
        "beforeAnnotation": {
            "文件后缀": "该文件后缀的头部注释之前添加某些内容"
        },
        "afterAnnotation": {
            "文件后缀": "该文件后缀的头部注释之后添加某些内容"
        },
        "specialOptions": {
            "特殊字段": "自定义比如LastEditTime/LastEditors"
        },
        "switch": {
            "newlineAddAnnotation": true
        },
        "supportAutoLanguage": [],
        "prohibitAutoAdd": [
            "json"
        ],
        "folderBlacklist": [
            "node_modules",
            "文件夹禁止自动添加头部注释"
        ],
        "prohibitItemAutoAdd": [
            "项目的全称, 整个项目禁止自动添加头部注释, 可以使用快捷键添加"
        ],
        "moveCursor": true,
        "dateFormat": "YYYY-MM-DD HH:mm:ss",
        "atSymbol": [
            "@",
            "@"
        ],
        "atSymbolObj": {
            "文件后缀": [
                "头部注释@符号",
                "函数注释@符号"
            ]
        },
        "colon": [
            ": ",
            ": "
        ],
        "colonObj": {
            "文件后缀": [
                "头部注释冒号",
                "函数注释冒号"
            ]
        },
        "filePathColon": "路径分隔符替换",
        "showErrorMessage": false,
        "writeLog": false,
        "wideSame": true,
        "wideNum": 15,
        "functionWideNum": 8,
        "CheckFileChange": false,
        "createHeader": false,
        "useWorker": false,
        "designAddHead": false,
        "headDesignName": "random",
        "headDesign": false,
        "cursorModeInternalAll": {},
        "openFunctionParamsCheck": true,
        "functionParamsShape": [
            "{",
            "}"
        ],
        "functionBlankSpaceAll": {},
        "functionTypeSymbol": "*",
        "typeParamOrder": "type param",
        "customHasHeadEnd": {},
        "throttleTime": 60000,
        "functionParamAddStr": "",
        "NoMatchParams": "no show param"
    },
    "fileheader.customMade": {
        "Author": "name", // 改成你的名字
        "Date": "", // 文件创建时间
        "LastEditors": "name", // 文件最后编辑者
        "LastEditTime": "", // 文件最后编辑时间
        "Versions": "V1.0",
        "Description":""
    },
    "fileheader.cursorMode": {}

文件后缀(必填):

.c和.cpp

你得到的注释(必填):

你生成的注释为:

/********************************************************************** 
 * @description: sin函数
 * @param    {short} radian
 * @return   {*}
 **********************************************************************/
short sin(short radian)
{
    unsigned char map = radian >> 6;
    unsigned char quadrant = radian >> 14;

    quadrant &= 0x3;
    switch (quadrant)
    {
        case 0x00: return sin_cos_map[map];
        case 0x01: return sin_cos_map[255 - map];
        case 0x02: return -sin_cos_map[map];

        case 0x03: return -sin_cos_map[255 - map];
        default  : return 0;
    }
}

预期的行为(必填):

预期得到的注释/行为:

/********************************************************************** 
 * @description:  sin函数
 * @param    {short} radian
 * @return   {short}
 **********************************************************************/
short sin(short radian)
{
    unsigned char map = radian >> 6;
    unsigned char quadrant = radian >> 14;

    quadrant &= 0x3;
    switch (quadrant)
    {
        case 0x00: return sin_cos_map[map];
        case 0x01: return sin_cos_map[255 - map];
        case 0x02: return -sin_cos_map[map];

        case 0x03: return -sin_cos_map[255 - map];
        default  : return 0;
    }
}

问题相关(选填)

这个返回值在某种特殊情况可以识别,但是这种特殊情况未能找到规律。所以不能复现出能正确识别返回值类型的情况。在绝大部分情况下都是不能正确识别返回值类型的。

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

1 participant