vscode 使用问题汇总
vscode setting 是 json, JSON 规范,不支持注释, # 注释无效果
soft tab 和 hard tab
最近使用 vscode 写 markdown 时,总遇到 markdownlint 的提示,说 No hard-tab,很是奇怪,于是上网搜索了一下。
hard-tabs 是硬件 tab,就是按一个 tab 键,soft-tabs 是软件 tab,通过按
4 个 space 键实现。 提倡使用 soft-tab 代替
hard-tab。(不论编程语言,还是 markdown),因为不同软件等对 hard-tab
的处理不一样,因此在协作或者换工具时,容易造成意想不到的 "灾难".
vscode 设置 hard-tab 自动转 soft-tab:
首先按 ctrl+shift+p
,输入
indent
,然后可以大致看到下图的选项,选择
Convert Indentation to Spaces
, 这样在你使用
tab
缩进的时候,vscode 就会自动帮你把 hard-tab 转换为
soft-tab 了。
此外,vscode 设置 soft-tab 对应的空格数也很简单,可以通过上图中的
Indent Using Spaces
或者点击下方状态栏右边
space
的地方,
vscode jupyter notebook 安装
Running cells with 'Python 3.10.8 ('torch_env')' requires ipykernel package.
Run the following command to install 'ipykernel' into the Python environment.
conda install -n torch_env ipykernel --update-deps --force-reinstall