Visual Studio Code工具使用及配置

最近迷上了這個工具,啓動速度快,好多插件。惟一不滿意的地方就是svn版本控制工具。下面發現我裝的一些插件及配置:javascript

我安裝的一些插件:css

上面是我裝的插件,等有時間再解釋下插件的做用。html

接下來講下配置:vue

進入設置步驟:java

進入設置頁面選擇工做區設置react

這是個人一些設置以下:shell

附上設置類容:json

{
  "workbench.startupEditor": "newUntitledFile",
  "workbench.editor.enablePreview": false, //打開文件不覆蓋
  "search.followSymlinks": false, //關閉rg.exe進程
  "editor.minimap.enabled": true, //關閉快速預覽
  "files.autoSave": "off", //打開自動保存
  "editor.lineNumbers": "on", //開啓行數提示
  "editor.quickSuggestions": {
    //開啓自動顯示建議
    "other": true,
    "comments": true,
    "strings": true
  },
  "editor.tabSize": 2, //每次保存自動格式化
  "eslint.autoFixOnSave": true, // 每次保存的時候將代碼按eslint格式進行修復
  "prettier.eslintIntegration": true, //讓prettier使用eslint的代碼格式進行校驗
  "prettier.semi": false, //去掉代碼結尾的分號
  "prettier.singleQuote": true, //使用帶引號替代雙引號
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true, //讓函數(名)和後面的括號之間加個空格
  "eslint.validate": [
    //開啓對.vue文件中錯誤的檢查
    "javascript",
    "javascriptreact",
    {
      "language": "html",
      "autoFix": true
    },
    {
      "language": "vue",
      "autoFix": true
    }
  ],
  "explorer.confirmDelete": false,
  "files.associations": {
    "*.vue": "vue",
    "*.html": "html"
  },
  "emmet.triggerExpansionOnTab": true,
  "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
}

還能夠設置用戶代碼模板。設置以下:windows

我用這個工具主要作vue開發的,下面分享我vue代碼片斷svn

搜vue.json而且打開它。將一下類容粘貼上去保存便可。

{
  "Print to console": {
    "prefix": "vue",
    "body": [
      "<template>",
      "    <div>\n",
      "    </div>",
      "</template>\n",
      "<script>",
      "export default {",
      "    props: {\n",
      "    },",
      "    components: {\n",
      "    },",
      "    watch: {\n",
      "    },",
      "    data() {",
      "        return {\n",
      "        };",
      "    },",
      "    computed: {\n",
      "    },",
      "    created() {\n",
      "    },",
      "    mounted() {\n",
      "    },",
      "    methods: {\n",
      "    },",
      "};",
      "</script>\n",
      "<style scoped lang=\"${1:scss}\">\n",
      "</style>\n"
    ],
    "description": "Create vue template"
  }
}

下面測試一下怎麼使用:

新建一個vue文件

輸入vue,按下enter或者tab鍵代碼生成。

效果以下:

相關文章
相關標籤/搜索