vscode

本文最后更新于:2024-01-26 22:27

前言

以前开发的时候使用的都是 JetBrains 公司的东西,但是每次弄激活就很麻烦,后来遇到了 vscode,感觉挺好用的,用的时间就挺长的。

这边文章就记录下使用时遇到的问题。

错误处理

参考链接:

在vscode中按ctrl + ,打开设置,设置中选择远程工作区。选中后,点击右上角的配置文件。

在配置文件中添加如下内容:

1
2
3
4
5
6
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/usr/bin/bash",
}
},
"terminal.integrated.defaultProfile.linux": "bash",

路径不是固定的,根据自己的实际情况来。

之后再运行就可以了。

Effective shfmt flags: -i=4

shell-format是 vscode 的一个格式化插件,通过快捷键alt + shift + f即可格式化.sh脚本内容。但是我在 vscode 插件商店中安装后,使用快捷键后在输出框中遇到了Effective shfmt flags: -i=4这个问题。

1
2
3
4
5
6
7
8
9
shfmt hasn't downloaded yet!Error: ENOENT: no such file or directory, stat '/root/.vscode-server/extensions/foxundermoon.shell-format-7.2.2/bin/shfmt_v3.3.1_linux_amd64'
Shfmt will be downloaded automatically!
download url: https://github.com/mvdan/sh/releases/download/v3.3.1/shfmt_v3.3.1_linux_amd64
download to: /root/.vscode-server/extensions/foxundermoon.shell-format-7.2.2/bin/shfmt_v3.3.1_linux_amd64
If the download fails, you can manually download it to the dest directory.
Or download to another directory, and then set the "shellformat.path" as the path
download shfmt page: https://github.com/mvdan/sh/releases
You can't use this plugin until the download is successful.
Effective shfmt flags: -i=4

这个问题是shfmt_v3.3.1_linux_amd64未下载完成导致的,我们可以根据提示中的两条download命令,分别下载

shfmt_v3.3.1_linux_amd64,并将其拷贝到/root/.vscode-server/extensions/foxundermoon.shell-format-7.2.2/bin/目录下,然后添加执行权限即可。


vscode
https://ahtoh.cn/2023/01/11/vscode/
作者
ahtoh
发布于
2023-01-11 20:34
许可协议