VSCode安装与配置
VS Code
安装
- 下载
- 默认安装
插件
- Language
- vscode-icons
改变文件图标 - Bracket Pair Colorizer
改变不同层次的括弧颜色 - Path Intellisense
填充路径 - Python
- Guides
- Code Spell Checker
- Anaconda Extension Pack
- Cmder && Git
To run Cmder as the VS Code terminal - Setting Sync
需要记住 GitHub Gist 和 Github Token - leetcode
- code-runner
配置
用户设置
1 | "window.zoomLevel": 0, |
Python 设置
1 | # 代码检查工具设置为flake8 |
运行代码(关于 vscode 中的相对路径)
在运行程序时,程序中的相对路径按照 cwd(current work directory)查找文件,而 cwd 的规则如下:
默认情况下,使用 code-runner.cwd 设置
如果 code-runner.cwd 未设置,code-runner.fileDirectoryAsCwd 为 true 使用要执行的文件目录
如果 code-runner.cwd 未设置,code-runner.fileDirectoryAsCwd 则 false 使用在 VS Code 中打开的根文件夹的路径
如果没有打开文件夹,请使用 os temp 文件夹
所以,如果想以程序文件所在位置编写相对路径,需要在设置中加入"code-runner.fileDirectoryAsCwd": true,
同时,在 launch.json 中的 configurations 下加入"cwd": "${fileDirname}"
评论