VSCode常用

setting.json默认位置

使用 Ctrl+Shift+P 或者点击左下角齿轮图标,选择命令面板。然后输入 settings.json 来搜索

mac

~/Library/Application Support/Code/User/settings.json

{
  "python.linting.flake8Enabled": true,
  "python.formatting.provider": "autopep8",
  "python.linting.flake8Args": [
      "--max-line-length=248"
  ],
  "python.linting.pylintEnabled": false,
  "python.formatting.autopep8Args": [
      "--max-line-length=248"
  ],
  "editor.fontSize": 14,
  "editor.fontFamily": "JetBrains Mono",
  "editor.tabSize": 4,
}

django项目

launch.json

{
  "name": "Python: Django",
  "type": "python",
  "request": "launch",
  "stopOnEntry": true,
  "program": "${workspaceFolder}/manage.py",
  "args": [
      "runserver",
      "--noreload",
      "--nothreading"
  ],
  "django": true
}

vue项目

{
    "typescript.preferences.quoteStyle": "single",
    "javascript.preferences.quoteStyle": "single",
    // tab 大小为2个空格
    "editor.tabSize": 2,
    // 保存时格式化
    "editor.formatOnSave": false,
    // 编辑器换行
    "editor.wordWrap": "off",
    // //让函数(名)和后面的括号之间加个空格
    "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
    // 开启 vscode 文件路径导航
    "breadcrumbs.enabled": true,
    // 选择 vue 文件中 template 的格式化工具
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    // 让vue中的js按编辑器自带的ts格式进行格式化
    "vetur.format.defaultFormatter.js": "vscode-typescript",
    // vetur 的自定义设置
    "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
            "wrap_line_length": 120,
            "wrap_attributes": "auto",//"force-aligned" //属性强制折行对齐
            "end_with_newline": false
        },
        "prettier": {
            "singleQuote": true,
            "semi": false,
            "printWidth": 100,
            "wrapAttributes": false,
            "sortAttributes": false,
            "trailingComma": "none",
        }
    }
}

安装的插件

Atom One Dark Theme - Mahmoud Ali

Catppuccin for VSCode - Catppuccin

Markdown All in One - Yu Zhang

Python - Microsoft

Pylance - Microsoft

Django Template - Roberth Solís

SFTP - Natizyskunk

CSS Peek - Pranay Prakash

参考:

  1. https://www.jianshu.com/p/bde39b7f72fe
  2. https://www.yisu.com/zixun/329293.html