超级替换
安装后在侧边栏操作
超级命令
安装后在侧边栏操作
函数解析
填写格式:
'=$123' :返回 input123 其中 $ 代表当前参数,直接替换
'=>123' 返回 123,可以使用 $,,moment,log,success,error,utils 等符号
'return 123' :与 '=>123'相同,返回 123
'({$,,moment,log,success,error,utils})=>123' :返回 123
其他: 直接返回字符串
{
filePath: () => document.uri.fsPath, // 当前文件的路径
fileName: () => path.basename(document.uri.fsPath), // 当前文件名
fileDir: () => path.dirname(document.uri.fsPath), // 当前文件所在文件夹
fileExtname: () => path.extname(document.uri.fsPath), // 当前文件的扩展名
replace: async (result) => { // 使用结果替换选择或光标处的单词
await editor.edit(doc => {
doc.replace(replaceSelection, result);
});
},
fs, path, os, vscode, exec, iconv, crypto, md5, // 常用工具
toast: (...msg) => vscode.window.showErrorMessage(msg.map(o => formatData(o)).join(' ')), // toast消息
log: (...msg) => log(msg.map(o => formatData(o)).join(' ')), // 打印到output
copy: async () => await vscode.env.clipboard.readText(), // 读取剪切板的内容
paste: async (text) => await vscode.env.clipboard.writeText(text), // 写入剪切板
workspaceFolders: () => vscode.workspace.workspaceFolders, // 当前工程路径
}