Microsoft has announced a new Python language server, pylance, which can communicate with vs code using the language server protocol. The name is a tribute to Monty Python's Lancelot, the first warrior among King Arthur and Knights of the round table.
Visual Studio Python language server and Python program manager Savannah Ostrowski says it is now available as an extension of the Visual Studio Marketplace, it "dramatically improves the Python experience in the Visual Studio Code. "
As early as 2018, Microsoft's Python team released the python language server, introducing visual studio's rich Python IntelliSense support into vs code. Now, Microsoft says that in the past few months, it has updated the language server to improve its performance and enable developers to write the best code. The result of this work is the new pyrance language server.
Pylance is a brand new language server based on Microsoft's static type checking tool Pyright using type stubs (. pyi file) and inert type inference to provide a high performance development experience. Pylance enhance the user's Python IntelliSense experience through rich type information, which can help users write code faster and better. Pylance extension is also accompanied by a collection of morphological stub files (Type Stub) for popular modules to provide fast, accurate automatic completion and type checking.
A number of key features provided by the Pylance include: type information, automatic import, type checking diagnostics, and multiple workspace support.
Microsoftexpress: "the type checking and language capabilities of pyright have now been incorporated into a vs code extension called pyrance, the python language server officially supported by Microsoft.".
"Pylance is intended to be used with VS Code Python extensions. Pylance added compatibility with several advanced features of the IntelliCode in addition to Pyright functionality to achieve AI assisted completion. We suggest you uninstall Pyright and install Pylance, if you're a VS Code user so you' ll get all the benefits and more and more ."
In addition, Microsoft also warned users not to install both pyright and pyrance at the same time, otherwise it would lead to repeated errors.
On the future, Microsoft revealed that Pylance represented a huge improvement in Python aspects of the VS Code, and the team spent months on it. A new language server can provide higher performance and more functionality, and the focus of the team will shift to Pylance, and continue to develop on it.
In the short term, users can continue to use the Microsoft Python language server when writing Python in vs code. But the company's long-term plan is to migrate all users to pyrance, eventually abandoning and removing the old language server.
More details to see the officialBlog.