美文网首页
VScode 使用经验小结

VScode 使用经验小结

作者: LA_Vida | 来源:发表于2020-05-24 15:06 被阅读0次

VScode 使用经验小结

一、我的settings.json

{
    "extensions.ignoreRecommendations": true,
    "editor.formatOnSave": true,
    "editor.formatOnPaste": true,
    "files.hotExit": "off",
    "files.insertFinalNewline": true,
    "files.trimTrailingWhitespace": true,
    "git.ignoreMissingGitWarning": true,
    "workbench.startupEditor": "newUntitledFile",
    "code-runner.runInTerminal": true,
    "explorer.confirmDelete": false,
    "editor.renderWhitespace": "all",
    "editor.fontFamily": "JetBrains Mono",
    "editor.fontLigatures": true,
}

二、VScode常用插件

* 1. C/C++
* 2. Python
* 3. Code Runner
* 4. indent-rainbow
* 5. Project Manager
* 6. Bracket Pair Colorizer2
# 7. Cmake
# 8. Cmake Tools
# 9. koroFileHeader
# 10. C++ Intellisense
# 11. Visual Studio ItelliCode

三、其他设置

  • 使用vscode配置Python环境时的几个注意事项

    • 以下三个路径需要添加环境变量

      .\Anaconda
      .\Anaconda\Scripts
      .\Anaconda\Library\bin
      
    • 输出需要位于终端中

    • py文件路径不能包含中文

    • 若终端执行"conda activate base"出错,则在powershell中运行

      conda init powershell
      
    • 若后续powershell中报错“因为在此系统上禁止运行脚本”,则在powershell中执行

      set-executionpolicy remotesigned
      
  • 我的自定义代码块

    • python

          "Encoding_UTF8": {
              "prefix": "utf8",
              "body": [
                  "# -*- coding:utf-8 -*-",
                  "$1"
              ],
              "description": "Encode with UTF-8"
          }
      
    • C

          "re_print": {
              "prefix": "print",
              "body": [
                  "int fputc(int ch, FILE *f)",
                  "{",
                  "    uint8_t temp[1] = {ch};",
                  "    HAL_UART_Transmit(&huart$1, temp, 1, 2);",
                  "    return ch;",
                  "}"
              ],
              "description": "串口重定向"
          }
      
  • 解决终端界面输出中文乱码问题

    • 终端调用的是powershell,而powershell默认代码页为936(GB 2312)

    • 临时修改代码页为UTF-8:chcp 65001

    • 永久修改代码页:在控制面板>>区域>>系统区域,将使用UTF-8打勾即可

  • koroFileHeader配置选项

    {
      // 文件头部注释
        "fileheader.customMade": {
            "Author": "lavida",
            "version": "",
            "Date": "Do not edit",
            "LastEditTime": "Do not Edit",
            "Description": ""
        },
        //函数注释
        "fileheader.cursorMode": {
            "name": "",
            "func": "",
            "param": "",
            "return": ""
        },
    }
    

相关文章

网友评论

      本文标题:VScode 使用经验小结

      本文链接:https://www.haomeiwen.com/subject/eecjahtx.html