我的 VS Code 相应配置

VS Code 下载

地址

插件安装

在这里插入图片描述
react 代码提示插件

React 代码块

// 安装完成该插件 ES7 React/Redux/GraphQL/React-Native snippets
// 编入 rcc + 回车 生成有状态的组件代码块 
import React, { Component } from 'react'

export default class Welcome extends Component {
  render() {
    return (
      <div>
        
      </div>
    )
  }
}

// rfc+tab键就可以生成无状态的组件代码块
// 编入 rfc + 回车 生成无状态的组件代码块
import React from 'react'

export default function Welcome() {
  return (
    <div>
      
    </div>
  )
}

配置用户代码片段

  • html.json

    {
    	"Print to desc": {
    		"prefix": "desc",
    		"body": [
    			"<meta name=\"description\" content=\"\" />"
    		],
    		"description": "Log output to 网站描述"
    	},
    	"Print to keyw": {
    		"prefix": "keyw",
    		"body": [
    			"<meta name=\"Keywords\" content=\"\" />"
    		],
    		"description": "Log output to 网站关键词"
    	},
    	"Print to viewp": {
    		"prefix": "viewp",
    		"body": [
    			"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0,maximum-scale=1,minimum-scale=1,user-scalable=no\">"
    		],
    		"description": "Log output to viewp"
    	},
    	"Print to ht": {
    		"prefix": "ht",
    		"body": [
    			"<!DOCTYPE html>",
    			"<html lang=\"en\">",
    			"<head>",
    			"\t<meta charset=\"UTF-8\">",
    			"\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0,maximum-scale=1,minimum-scale=1,user-scalable=no\">",
    			"\t<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">",
    			"\t<title>首页$1</title>",
    			"</head>",
    			"<body>",
    			"\t$2",
    			"</body>",
    			"<script src=\".\"></script>",
    			"<script>",
    			"\t$3",
    			"</script>",
    			"</html>"
    		],
    		"description": "Log output to h5基本架构"
    	},
    	"html-vue": {
    		"scope": "html",
    		"prefix": "hvue",
    		"body": "<!DOCTYPE html>\n<html lang=\"en\">\n<head> \n\t<meta charset=\"UTF-8\"> \n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> \n\t<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n\t<title>$TM_FILENAME_BASE</title>\n\t<style>\n\t\t\n\t</style> \n</head> \n<body>\n\t<div id=\"app\">\n\t</div>\n\t<script src=\"https://cdn.jsdelivr.net/npm/vue/dist/vue.js\"></script>\n\t<script>\n\t\t$0\n\t</script> \n</body>\n</html>"
    	},
    	"html-router": {
    		"scope": "html",
    		"prefix": "hrouter",
    		"body": "<!DOCTYPE html>\n<html lang=\"en\">\n<head> \n\t<meta charset=\"UTF-8\"> \n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> \n\t<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n\t<title>$TM_FILENAME_BASE</title>\n\t<style>\n\t\t\n\t</style> \n</head> \n<body>\n\t<div id=\"app\">\n\t\t<router-view></router-view>\n\t</div>\n\t<script src=\"https://cdn.jsdelivr.net/npm/vue/dist/vue.js\"></script>\n\t<script src=\"https://unpkg.com/vue-router/dist/vue-router.js\"></script>\n\t<script>\n\t\t$0\n\t</script> \n</body>\n</html>"
    	}
    }
    
  • javascript.json

    {
    	"Print to fn-description": {
    		"prefix": "desc",
    		"body": [
    			"/**",
    			" * @description ",
    			" * @param {} ",
    			" * @param {} ",
    			" * @returns {} ",
    			" */",
    			"$2"
    		],
    		"description": "用于描述封装函数相关作用"
    	},
    	"Print to fn": {
    		"prefix": "fn",
    		"body": [
    			" (${e}) => {$0",
    			"}"
    		],
    		"description": "用于快捷生成箭头函数"
    	}
    }
    
  • vue.json

    {
    	"Print to ht": {
    		"prefix": "v",
    		"body": [
    			"<template>",
    			"\t<div class=\"$TM_FILENAME_BASE\">$0</div>",
    			"</template>\n",
    			"<script>",
    			"export default {",
    			"\t",
    			"}",
    			"</script>\n",
    			"<style lang=\"${less}\" scoped>",
    			"\t",
    			"</style>"
    		],
    		"description": "Log output to vue架构"
    	}
    }
    
  • Eslint.json

    {
        "editor.fontSize": 16,
        // "cssrem.rootFontSize": 32,
        "liveServer.settings.donotShowInfoMsg": true,
        "javascript.updateImportsOnFileMove.enabled": "always",
        "eslint.validate": [
          "javascript",
          "javascriptreact",
          "vue-html",
          {
            "language": "vue",
            "autoFix": true
          },
          "html",
          "vue"
        ],
        "less.compile": {
          "outExt": ".css"
        },
        "eslint.autoFixOnSave": true,
        // 需要 npm install -g eslint-plugin-vue
        "eslint.options": {
          "extensions": [
            ".js",
            ".vue"
          ]
        },
        "explorer.confirmDragAndDrop": false,
        "files.autoSave": "afterDelay",
        "editor.wordWrap": "on",
        "sync.autoDownload": true,
        "sync.autoUpload": true,
        "sync.forceDownload": true,
        "sync.forceUpload": true,
        "workbench.iconTheme": "material-icon-theme",
        "dart.debugExternalLibraries": true,
        "dart.debugSdkLibraries": false,
        "editor.codeActionsOnSave": {
          "source.fixAll.eslint": true
        },
    }
    

快捷键使用

  • General

    按 Press功能 Function
    Ctrl + Shift + P,F1显示命令面板 Show Command Palette
    Ctrl + P快速打开 Quick Open
    Ctrl + Shift + N新窗口/实例 New window/instance
    Ctrl + Shift + W关闭窗口/实例 Close window/instance
  • 基础编辑

    按 Press功能 Function
    Ctrl+X剪切行(空选定) Cut line (empty selection)
    Ctrl+C复制行(空选定)Copy line (empty selection)
    Alt+ ↑ / ↓向上/向下移动行 Move line up/down
    Shift+Alt + ↓ / ↑向上/向下复制行 Copy line up/down
    Ctrl+Shift+K删除行 Delete line
    Ctrl+Enter在下面插入行 Insert line below
    Ctrl+Shift+Enter在上面插入行 Insert line above
    Ctrl+Shift+\跳到匹配的括号 Jump to matching bracket
    Ctrl+] / [缩进/缩进行 Indent/outdent line
    Home转到行首 Go to beginning of line
    End转到行尾 Go to end of line
    Ctrl+Home转到文件开头 Go to beginning of file
    Ctrl+End转到文件末尾 Go to end of file
    Ctrl+↑ / ↓向上/向下滚动行 Scroll line up/down
    Alt+PgUp / PgDown向上/向下滚动页面 Scroll page up/down
    Ctrl+Shift+[折叠(折叠)区域 Fold (collapse) region
    Ctrl+Shift+]展开(未折叠)区域 Unfold (uncollapse) region
    Ctrl+K Ctrl+[折叠(未折叠)所有子区域 Fold (collapse) all subregions
    Ctrl+K Ctrl+]展开(未折叠)所有子区域 Unfold (uncollapse) all subregions
    Ctrl+K Ctrl+0折叠(折叠)所有区域 Fold (collapse) all regions
    Ctrl+K Ctrl+J展开(未折叠)所有区域 Unfold (uncollapse) all regions
    Ctrl+K Ctrl+C添加行注释 Add line comment
    Ctrl+K Ctrl+U删除行注释 Remove line comment
    Ctrl+/切换行注释 Toggle line comment
    Shift+Alt+A切换块注释 Toggle block comment
    Alt+Z切换换行 Toggle word wrap

    默认快捷键

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值