【教程】vsc snippet 代码模板:代码头部说明
首先,ctrl+shift+P打开vsc的交互式指令终端,输入snippet,选择创建用户snippet片段,范围选择为全局(可能提示命名文件名,可以任意)。然后粘贴以下代码
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
"Code_Brief": {
"prefix": "\\info",
"body": [
"${1|#,//,;,%|} coding = ${2|utf-8,gbk,GB2312|}",
"${1|#,//,;,%|} Arch = ${3|x86-ia32,x86-AMD64,ARM,RISC|}",
"${1|#,//,;,%|}",
"${1|#,//,;,%|} @File name: ${TM_FILENAME}",
"${1|#,//,;,%|} @brief: ${5|None|}",
"${1|#,//,;,%|} @attention: ${6|None|}",
"${1|#,//,;,%|} @cite: ${7|None|}",
"${1|#,//,;,%|} @Author: ${8|Authors,anonymous|}",
"${1|#,//,;,%|} @History: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}\t\tCreate"
],
"description": "代码头部说明文档"
}
}
——
如此,即可在任意代码文件第一行,键入\info启动一个用于代码说明的模板
效果:
% coding = utf-8
% Arch = x86-AMD64
%
% @File name: main.m
% @brief: 简单LFMCW雷达仿真,GPU性能加速版本
% 噪声归一化为 N(0, 1) 的高斯白噪声(复数)
% 目标的距离,速度已经确认正确
% 复基带信号,不会混叠
% 有效范围 :
% R = 0~200m
% V = ±15m/s
% A 不知道,最好是±60度之内吧,一般是典型值
% 目标强度:用dBsm定义,比如0dBsm就是abs幅度为1,20dBsm就是幅度为10
% 可以修改目标生成的地方为自己需要生成的目标情况,在文件: target_info.m
% 可以通过仿真点目标的方法,仿真出一个有外形的目标.
% @attention: 需要设置MATLAB的并行池为 thread 模式,以更快启动 parfor (502和555已经让我改过默认设置了)
% 如果需要整个流程,那么需要:
% 1. 使用上一级目录的 cfar 检测目标RD
% 2. 基于目标的位置,索引出天线维度上的切片(其实是一个“棍子”)
% 3. 原始 RawData 做FFT1D
% 4. 再进行一次CFAR1D测角A
% 5. 得到目标的距离-速度-角度。
% @cite: None
% @Author: wyb
% @History: 2024-09-28 Create
2024年9月28日
