vscode 详细编译、调试步骤

更多新鲜技术资讯,欢迎关注公众号: 深度极客

了解更多开源技术,请关注以上公众号

步骤一:搭建环境

参考官方文档进行编译:
https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run-from-source

如果已经编译过,可以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二进制包,更新包)https://phoenixnap.com/kb/update-node-js-version

sudo npm install node-gyp 升级npm

解决 node-gyp graceful-fs错误(这个问题可以不用解决):https://github.com/apostrophecms/mechanic/issues/19

步骤二:安装依赖

打开vscode目录,执行yarn命令

报错:

1.native-keymap : https://blog.youkuaiyun.com/AS_JOPO/article/details/106436785

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"
}

参考网址:

https://stackoverflow.com/questions/37143536/no-extensions-found-when-running-visual-studio-code-from-source

3.调试过程会出现需要手动打开cpptools里面的后端,不然调试会报错

:vscode-cpptools/vscode-cpptools/Extension/debugAdapters/bin/OpenDebugAD7

其它

查看端口号命令,用于查看调试后端是否启动:

netstat -tunlp | grep vscode

更多新鲜技术资讯,欢迎关注公众号: 深度极客

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值