Giter Site home page Giter Site logo

file-header's Introduction

IDEA/Webstorm 利用file watchers自动生成文件头部注释

注释示例:

/*
 * @Author: name
 * @Date: 2021-06-10 20:54:26
 * @LastEditors: name
 * @LastEditTime: 2021-06-10 21:09:06
 * @Description: desc
 */

效果:js文件修改后,将@LastEditors: 后面的name替换成自己的姓名、@LastEditTime: 后面的时间替换成当前时间。

目前是判断代码里面是否包含@LastEditors: 以及@LastEditTime:来辨别是否有头部注释。注释格式可以通过源码来调整,不修改app.js源码就使用的话一定要把注释写成这个格式

源码格式在27~47行,看着修改一下就好。

系统环境:Nodejs v12+

将项目拉下来以后,妥善保存app.js

打开watchers.xml,将

<option name="arguments" value="C:\Users\cinitswift\Desktop\app.js $FileDir$ $FileName$ $FileEncoding$ $FileExt$ name" />

该项value中的路径替换成你电脑上app.js绝对路径,并把$FileExt$后面的name替换成你的姓名

打开Idea或者webstorm -> File -> Settings -> Tools -> File Watchers,点击import,选择watchers.xml导入。

1623331887938

导入后把它勾选上,点击右下角的apply和ok就完事了。

其他的文件例如vue或者java文件修改app.js里面的代码也能做到该类文件头注释的修改。

最后就是导入xml之后一定不要换app.js的位置,换了路径的话要把它里面arguments里面的路径修改成当前路径

file-header's People

Contributors

cinitswift avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.