Ubuntu 22.04中Snap版VSCode无法打开同步设置重定向URI
解决Snap版VSCode Settings Sync无法跳转回应用的问题
临时快速解决(单次生效)
- 在GitHub完成认证后,复制浏览器地址栏中以
vscode://vscode.github-authentication/did-authenticate?开头的完整链接 - 打开VSCode,按
Ctrl+Shift+P唤起命令面板,输入并执行Settings Sync: Show Login Information,粘贴刚才复制的链接后回车,即可完成同步配置
永久修复(解决协议关联问题)
Snap版VSCode因沙箱特性,可能未正确注册vscode://协议关联,手动配置即可:
- 创建或编辑
~/.local/share/applications/code-url-handler.desktop文件,写入以下内容:
[Desktop Entry] Name=Visual Studio Code - URL Handler Comment=Handle vscode:// URLs Exec=/snap/bin/code --open-url %U Icon=code Type=Application NoDisplay=true Categories=Development;IDE; MimeType=x-scheme-handler/vscode;
- 更新系统应用数据库:
update-desktop-database ~/.local/share/applications/
- 设置
vscode://协议默认由VSCode处理:
xdg-mime default code-url-handler.desktop x-scheme-handler/vscode
- 重启Firefox和VSCode,再次尝试Settings Sync,认证完成后即可自动跳转回应用
额外检查(Firefox端配置)
- 打开Firefox,输入
about:preferences#general滚动到「应用程序」区域 - 找到
vscode协议项,确认默认动作设置为「使用Visual Studio Code」(若未显示,重启浏览器后再查看)
内容的提问来源于stack exchange,提问作者EyeBrowse
相关产品推荐
相关产品推荐

