1 Star 0 Fork 0

Capsion-ST-PLugins / Comments-Creator

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

简介|Introductions

自用的 jdDoc 格式注释模板注入插件,原理是采用正则匹配,以前不知道有AST模块的时候写的,也没时间重构,就边用边更新了。

注意: 插件市场有专业的功能相似的插件,我只是单纯为了自己用的爽菜写的 😁,才不是因为它配置太复杂才自己造轮子,请有需要的朋友请使用专业插件。

  • 本插件为团队内部打造使用,不对外更新负责,
  • 2023年了,前端建议采用VSCode

功能|Feature

screenshot cps-Comments-Creator

  • 在光标所选的函数上创建jsdoc风格的注释
  • 在新增参数的旧注释上,保留原注释的情况下追加新参数
  • 支持多行写法的函数(参数太多)
  • 支持pyjs系
  • 核心采用了正则匹配,后续可能会更新为AST语法解析的模式(有想法,没时间系列)

使用|Usage

快捷键:Alt + q 在函数行键入即可,暂时 py 使用比较多,js 和 ts 部分语法不能识别,也没空更新

创建注释块

setp1

step1

更新现有注释块

setp2

step2

插件配置|Configure

// Packages/User/cps.sublime-settings
{
  "name": "tett 插件",
  "author": "CPS",
  "mail": "373704015@qq.com", //本插件任何问题请联系qq

  // prettier-ignore
  "cps_comments_creator": {
    // 全局默认配置
    "max_search_count":80,       // 搜索行数(正数从上向下查找, 负数反之)
    "params_alignment":"  ",     // [indent<string>] 是否对齐参数
    "comments_direction":"up",   // "down"|"up" 函数名字上一行,函数名字下一行
    "default_tmpl":{
      "comments_contexts":{
        "Description":true,
        "param":":param {type} {name} {description}",
        "returns":":returns {type} {description}",
      }
    },

    /* 根据后缀名设置 */
    "py": {
      "comments_direction": "down",
      "comments_contexts":{
        "Description":"@Description {description}\n",
        "param":"- param {name} :{type} {description}",
        "returns":"\n@returns `{type}` {description}"
      },
      "comments_header": [
        "    \"\"\"",      // 注释区的开始标识
        "    ",            // 内容位置的前缀
        "    \"\"\"",      // 注释区的结束
      ]
    },

    "js":{
      "comments_contexts":{
        "Description":"@Description - {description}\n",
        "param":"@param {type} {name}  - {description}",
        "returns":"\n@returns {type} - {description}"
      },
      "comments_header": [
        "/**",        //    /**
        " * ",        //     * 内容位置的前缀
        " */"         //     */
      ]
    },

    "mjs":{
      "comments_contexts":{
        "Description":"@Description - {description}\n",
        "param":"@param {type} {name}  - {description}",
        "returns":"\n@returns {type} - {description}"
      },
      "comments_header": [
        "/**",        //    /**
        " * ",        //     * 内容位置的前缀
        " */"         //     */
      ]
    },

    "ts":{
      "comments_contexts":{
        "Description":"@Description - {description}\n",
        "param":"@param {type} {name}  - {description}",
        "returns":"\n@returns {type} - {description}"
      },
      "comments_header": [
        "/**",        // /**
        " * ",        //  * 内容位置的前缀
        " */"         //  */
      ]
    },

    "vue":{
      "comments_contexts":{
        "Description":" @Description {description}\n",
        "param":" @param {type} {name}  {description}",
        "returns":"\n @returns {type} {description}"
      },
      "comments_header": [
        "/**",      // /**
        " * ",      //  * @Description:
        " */"       //  */
      ]
    }
  }
  // prettier-ignore
}

联系方式|Contact

  • 373704015 (qq、wechat、email)

空文件

简介

个人自用,基于正则表达式来添加头部注释的插件,没有用zst,因为这是当初还不懂什么叫语法树年轻时期的产物 展开 收起
取消

发行版 (1)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/Capsion-ST-PLugins/Comments-Creator.git
git@gitee.com:Capsion-ST-PLugins/Comments-Creator.git
Capsion-ST-PLugins
Comments-Creator
Comments-Creator
master

搜索帮助