Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vs code 配置 #40

Open
huangshuwei opened this issue Apr 16, 2020 · 0 comments
Open

vs code 配置 #40

huangshuwei opened this issue Apr 16, 2020 · 0 comments
Labels

Comments

@huangshuwei
Copy link
Owner

huangshuwei commented Apr 16, 2020

前言

从 webstorm 转到 vs code 一阵子了。期间vuejs、react+ts、electron 项目不断切换,还没有领略到vs code 给我极致体验,问题倒是不少,毕竟只是个编译器,孰能生巧吧。在此记录一些折腾的过程,方便后面自己查看。

typescript 关闭 .js 文件检测

没太明白为什么 .js 文件会被识别为 .ts 文件,有一大推修改建议和报错,干脆关上。
具体步骤,设置->输入“typescript”->勾掉“启用/禁用 JavaScript 验证”

固定打开的文件

默认情况我们打开了几个页面,我们想切换最近的两个页面,通常使用ctrl+tab键切换后发现并不是最近的两个文件。下面配置可以解决这个问题

"workbench.editor.enablePreview": false
"workbench.editor.enablePreviewFromQuickOpen": false

设置代码片段

可以将我们常用的代码设置为代码片段,方便我们重复使用。下面以快速创建 vue模板为例

路径:文件 -> 偏好 -> 用户代码片段 ->找到 vue.json 。输入你的代码片段即可(参考样例)

{
  "create vue template": {
    "prefix": "vue",
    "body": [
      "<template>",
      "\t<div class='$2'></div>",
      "</template>",
      "",
      "<script>",
      "",
      "export default {",
      "\tname: '$1',",
      "\tcomponents: {},",
      "\tprops: {},",
      "\tdata() {",
      "\t\treturn {",
      "",
      "\t\t};",
      "\t},",
      "\tcomputed: {},",
      "\twatch: {},",
      "\tmethods: {",
      "",
      "\t},",
      "\tcreated() {",
      "",
      "\t},",
      "\tmounted() {",
      "",
      "\t},",
      "}",
      "</script>",
      "<style lang='$3'>",

      "</style>"
    ],
    "description": "自定义 vue 模板"
  }
}

这样当我们在空白的vue 文件中输入 vue时就会有提示,按回车键即可看到效果

继续补充...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant