DevEco Studio配置:自定义头部代码注释

Posted 坚果的博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DevEco Studio配置:自定义头部代码注释相关的知识,希望对你有一定的参考价值。

DevEco Studio配置:自定义头部代码注释

1.实现效果

/*
 * Copyright (c) 2022 JianGuo Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**     
  * @ProjectName : nutsStudy
  * @FileName :  setting
  * @Author : 坚果
  * @Time : 2022/8/5 13:51
  * @Description : 文件描述 
 */

2.实现步骤

依次操作File – Settings – Editor – File and Code Templates,在详细展示窗口点击includes选项卡,找到

FileHeader点击,在编辑窗口输入自定义的注释模板即可。如下图:

3. 总结

$PACKAGE_NAME新建文件所在包名
$USER用户名
$DATE创建文件时当前系统的日期(格式:yyyy/MM/dd)
$TIME创建文件时当前系统的时间(格式:hh:mm)
$YEAR创建文件时当前系统的年份
$MONTH创建文件时当前系统的月份
$MONTH_NAME_SHORT当前月份的前三位字符缩写,例如: Jan, Feb, etc
$MONTH_NAME_FULL当前月份的字母全写,例如: January, February, etc
$DAY当前时间所属月份的天数
$HOUR当前的小时数
$MINUTE当前的分钟数
$PROJECT_NAME当前的项目名
$NAME当前的文件名

4.我添加的内容

/*
 * Copyright (c) 2022 JianGuo Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**     
  * @ProjectName : $PROJECT_NAME
   * @FileName : $NAME
  * @Author : 坚果
  * @Time : $DATE $TIME
  * @Description : 文件描述 
 */

效果:

以上是关于DevEco Studio配置:自定义头部代码注释的主要内容,如果未能解决你的问题,请参考以下文章

DevEco Studio配置:自定义头部代码注释

Visual Studio 2019 修改注释快捷键和添加自定义头部注释

Visual Studio 2019设置自定义头部注释

鸿蒙开发工具DevEco Studio中设置方法带参数注释快捷键

HarmonyOS(鸿蒙)开发软件DevEco Studio基本配置(兼容IDEA)

Visual Studio Code 文件头部注释说明的配置