如何切换 VS Code 使用 Pylance 而不是 Jedi?
我正在尝试使用 结构模式匹配 (PEP634) 来自 Python 3.10,但是 Jedi 语言服务器不支持该语法。我听说 Pylance 更好,但我找不到任何切换 VS Code 的方法到皮兰斯。
我已下载默认的 Python 扩展,但仅限 Jedi 语言服务器正在运行。
我怎样才能进行切换?
编辑
添加一张尝试搜索“pylance”的图片,这样就不会有混淆,它根本不存在。它似乎声称它是 Python 扩展的一部分,但所使用的语言服务器始终是 Jedi。
I am trying to use Structural Pattern Matching (PEP634) from Python 3.10, but Jedi language server doesn't support the syntax. I've heard Pylance is better, but I can't find any way to switch VS Code to Pylance.
I've downloaded the default Python extension, but only the Jedi language server is running.
How can I make the switch?
EDIT
Adding a picture of trying to search for "pylance" so there's no confusion, it's not there at all. It seems to claim it's part of the Python extension, but the language server being used is always Jedi.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我使用的是 VS Code 的开源版本,它没有所有扩展。切换到专有版本(可在 AUR 上找到)解决了我的问题。
I was using the open source version of VS Code which doesn't have all extensions. Switching to the proprietary version (available on the AUR) fixed my issue.
更改设置:
python.languageServer
Change the setting:
python.languageServer
Pylance 与 VSCodium 不兼容。即使您使用官方 Marketplace 安装它,Pylance 也会显示以下消息:
您最终可以将
python.languageServer
设置设置为None
,并使用Pyright 用于类型检查。Pylance is not compatible with VSCodium. Even if you install it with the official Marketplace, Pylance will display this message:
You can eventually set
python.languageServer
setting toNone
, and use Pyright for type checking.转到
设置>;扩展> Python
,前往语言服务器
并将默认
更改为Pylance
。此修复程序也适用于开源版本 VS Codium。它应该与您使用的 VScode 版本无关。
Go to
Settings > Extensions > Python
, head down toLanguage Server
and changeDefault
toPylance
.This fix also works in the Open Source version, VS Codium. It should have nothing to do with the version of VScode you're using.