vscode如何创建自定义快捷键模板(typescript React示例)

您所在的位置:网站首页 vscode怎么插入网站 vscode如何创建自定义快捷键模板(typescript React示例)

vscode如何创建自定义快捷键模板(typescript React示例)

2023-06-24 03:31| 来源: 网络整理| 查看: 265

1.vs面板左下角设置-配置用户代码片段

2. 弹出搜索框中输入typescript会出来2个选项,选择第二个react

 3.在代码片段中添加自己的快捷键设置片段(用$TM_FILENAME_BASE$1可以获取当前文件的名称)

{ // Place your snippets for typescriptreact here. Each snippet is defined under a snippet name and has a prefix, body and // description. 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. // Example: // "Print to console": { // "prefix": "log", // "body": [ // "console.log('$1');", // "$2" // ], // "description": "Log output to console" // } "tsxr": { "prefix": "tsxr", "body": [ "import React from 'react';", "", "const $TM_FILENAME_BASE$1: React.FC = () => {", " return (", " ", " );", "}", "", "export default $TM_FILENAME_BASE$1;" ], "description": "TypeScript React FC component" } }



【本文地址】


今日新闻


推荐新闻


    CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3