如何切换 VS Code 使用 Pylance 而不是 Jedi?

发布于 2025-01-15 03:41:24 字数 981 浏览 1 评论 0原文

我正在尝试使用 结构模式匹配 (PEP634) 来自 Python 3.10,但是 Jedi 语言服务器不支持该语法。我听说 Pylance 更好,但我找不到任何切换 VS Code 的方法到皮兰斯。

我已下载默认的 Python 扩展,但仅限 Jedi 语言服务器正在运行。

我怎样才能进行切换?


编辑

添加一张尝试搜索“pylance”的图片,这样就不会有混淆,它根本不存在。它似乎声称它是 Python 扩展的一部分,但所使用的语言服务器始终是 Jedi。
输入图片此处描述

Python 扩展包: 输入图片此处描述

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.
enter image description here

Python extension packs:
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

他夏了夏天 2025-01-22 03:41:24

我使用的是 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.

静水深流 2025-01-22 03:41:24

更改设置:python.languageServer

Change the setting: python.languageServer

后eg是否自 2025-01-22 03:41:24

Pylance 与 VSCodium 不兼容。即使您使用官方 Marketplace 安装它,Pylance 也会显示以下消息:

您只能通过 Microsoft Visual Studio、Visual Studio for Mac、Visual Studio Code、Azure DevOps、Team Foundation Server 以及后续 Microsoft 产品和服务(统称为“Visual Studio产品和服务”)来开发和测试您的应用程序。 [...]

您最终可以将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 may install and use any number of copies of the software only with Microsoft Visual Studio, Visual Studio for Mac, Visual Studio Code, Azure DevOps, Team Foundation Server, and successor Microsoft products and services (collectively, the “Visual Studio Products and Services”) to develop and test your applications. [...]

You can eventually set python.languageServer setting to None, and use Pyright for type checking.

独行侠 2025-01-22 03:41:24

转到设置>;扩展> Python,前往语言服务器并将默认更改为Pylance
此修复程序也适用于开源版本 VS Codium。它应该与您使用的 VScode 版本无关。

Go to Settings > Extensions > Python, head down to Language Server and change Default to Pylance.
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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文