code –verbose 后报错:
[20447:0201/143519.959342:ERROR:browser_main_parts.cc(139)] X IO error received (X server probably went away)
这个似乎是一个 Electron 里面的 bug,一个可行的解决方案为:
# make a copy of the relevant library mkdir ~/lib cp /usr/lib/x86_64-linux-gnu/libxcb.so.1 ~/lib sed -i 's/BIG-REQUESTS/_IG-REQUESTS/' ~/lib/libxcb.so.1 # set the dynamic loader path to put your library first before executing VS Code LD_LIBRARY_PATH=$HOME/lib code
即修改一下 libxcb.so.1 之后再执行
对于 .desktop 文件启动的 VSCode(桌面的菜单项),将上述修改的 .so 文件复制到比如 /opt/code_lib 下,将 /usr/share/applications/code.desktop 中的 Exec 项修改为:
Exec=sh -c "env LD_LIBRARY_PATH\=/opt/code_lib /usr/share/code/code" %U
即可