VS Code 使用技巧及常见问题

原创
2018/09/18 09:16
阅读数 369

001. Ubuntu重新安装VSCode无法在xrdp桌面环境打开的问题

之前安装过vscode,并且在xrdp桌面环境可以正常打开,后来下载了新版本的vscode的deb包,在root用户下以dpkg -i命令安装之后,就发现不能在桌面环境打开了。网上查了一下,要先删除/home/user/.config目录下的Code配置目录,再用dpkg -i安装。

参考网址:https://stackoverflow.com/questions/50668990/visual-studio-code-cant-run-in-ubuntu-18-04

 

 

002. VS Code 安装extension一直卡在"installing"状态

在Ubuntu 16.04系统下载code_1.27.2-1536736588_amd64.deb安装包,在root用户下以"dpkg -i"安装完成之后,打开VS Code发现extension界面中自带的"python"、和"redhat yaml"两个extension一直处在"installing"状态,重启vs code也没有作用。

原因分析:是由于安装的时候用的root权限,因此~/.vscode目录也是root权限,结果在普通用户下打开vs code,自然没有权限访问root创建的目录和配置文件了。

解决方法:把~/.vscode目录的属主和属组都设为当前普通用户,再次打开vscode就可以了。

另外说明:

在外网不通的情况下,可以到vs code官网下载extension文件,在vs code中打开extension安装界面,进行手动安装

 

003. VS Code 设置tab为4个空格、显示空白符、”Ctrl + 鼠标滚轮“缩放文本大小

File > Preferences > Settings > 点击"{}"图标 (Open Settings (JSON)) > 在"settings.json"编辑界面,添加内容如下:

{
    // The number of spaces a tab is equal to. This setting is overriden
    // based on the file contents when `editor.detectIndentation` is true.
    "editor.tabSize": 4,

    // Insert spaces when pressing Tab. This setting is overriden
    // based on the file contents when `editor.detectIndentation` is true.
    "editor.insertSpaces": true,

    // When opening a file, `editor.tabSize` and `editor.insertSpaces`
    // will be detected based on the file contents. Set to false to keep
    // the values you've explicitly set, above.
    "editor.detectIndentation": false,

    // Controls how the editor should render whitespace characters.
    //  - none
    //  - boundary: Render whitespace characters except for single spaces between words.
    //  - all
    "editor.renderWhitespace": "all",

    // Zoom the font of the editor when using mouse wheel and holding `Ctrl`.
    "editor.mouseWheelZoom": true,

    // Specify path of python interpreter.
    "python.pythonPath": "/bin/python3",

    // Never show the dialog
    "explorer.confirmDelete": false

}

 

 

004. Remote SSH Server changed user groups but not applied in VSCode

Try to kill vs code-remote host through the command after pressing ctrl + shift + p and enter

Remote-SSH: kill VS Code Server on Host...

Then choose your host

Ref: https://stackoverflow.com/a/57494961

 

005. VSCode Upgrade Issue - Cannot connect to remote server

Note - extra steps:

1) download history release of VSCode from here - download the release that the version is consistent with your current VSCode version

2) follow the steps

 

 

 

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部