更多新鲜技术资讯,欢迎关注公众号: Linux开源先锋
以下将介绍如何在 Linux 系统上编译 VSCode 源码。
步骤一:搭建环境
参考官方文档进行编译: github.com/Microsoft/v…
如果已经编译过,可以rm ~/.cache/node-gyp 删除缓存
1.首先安装nodejs和npm sudo apt-get install nodejs sudo apt-get install npm 2.安装yarn和node-gyp npm install --global yarn npm install -g node-gyp
如果之前已经安装,可以使用清除命令:
清除缓存命令:yarn cache clean
(安装node二进制包,更新包)phoenixnap.com/kb/update-n…
sudo npm install node-gyp 升级npm
解决 node-gyp graceful-fs错误(这个问题可以不用解决):github.com/apostrophec…
步骤二:安装依赖
打开vscode目录,执行yarn命令
报错:
1.native-keymap : blog.csdn.net/AS_JOPO/art…
2.vscode-ripgrep: Command failed : 再执行yarn
3.electron: Command failed : 再执行yarn
其它命令未找到或有错误也是重新执行即可
步骤三:调试
执行完上述命令,再执行./scripts/code.sh就可以开始调试了
(如果执行脚本出现chrome-sandbox权限问题,请执行下面的命令:sudo chown root:root chrome-sandbox,sudo chmod 4755 chrome-sandbox)
调试过程可能发现vscode oss无法安装扩展,参照下面的解决办法:
1.在系统中找到product.json文件
2.在其中添加如下内容:
"extensionsGallery": {
"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
"cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
"itemUrl": "https://marketplace.visualstudio.com/items"
}
参考网址:
stackoverflow.com/questions/3…
3.调试过程会出现需要手动打开cpptools里面的后端,不然调试会报错
:vscode-cpptools/vscode-cpptools/Extension/debugAdapters/bin/OpenDebugAD7
其它
查看端口号命令,用于查看调试后端是否启动:
netstat -tunlp | grep vscode
更多新鲜技术资讯,欢迎关注公众号: Linux开源先锋