必备快捷键

导航

编辑

推荐插件

开发效率

美化

高级技巧

多光标编辑

按住 Option 点击多个位置,或使用 Cmd + D 逐步选择相同的词。

代码片段

// 创建自定义代码片段
"React Component": {
  "prefix": "rc",
  "body": [
    "import React from 'react';",
    "",
    "const ${1:ComponentName} = () => {",
    "  return (",
    "    
$0
", " );", "};", "", "export default ${1:ComponentName};" ], "description": "Create React component" }

工作区设置

在项目根目录创建 .vscode/settings.json,可以为项目设置专属配置:

{
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
}

总结

掌握这些技巧和插件,可以让你的开发效率大幅提升。建议花时间配置适合自己的开发环境,磨刀不误砍柴工。