MITB Banner

A New Python Language Support In Visual Studio Code

Share

Illustration by REDMOND, WASHINGTON - JULY 17: A building on the Microsoft Headquarters campus is pictured July 17, 2014 in Redmond, Washington. Microsoft CEO Satya Nadella announced, July 17, that Microsoft will cut 18,000 jobs, the largest layoff in the company's history. (Stephen Brashear/Getty Images)

Recently, Microsoft announced Pylance, which is fast and feature-rich language support for Python in Visual Studio Code. According to a blog post, the name Pylance serves as a bow to Monty Python’s Lancelot, who is known to be the first knight to answer the bridgekeeper’s questions in the Holy Grail.

Two years back, the Python team of the tech giant released the Python Language Server that brought Visual Studio’s rich Python IntelliSense support to Visual Studio Code. The Pylance language server is an enhancement to the Python Language Server. 

Behind Pylance

Pylance is a language server for Python language that utilises the Language Server Protocol in order to communicate with Visual Studio Code. The developers at the tech giant created Pylance as a brand-new language server based on Microsoft’s Pyright static type checking tool in order to deliver an improved user experience.

Pylance provides users with the ability to customise their Python language support through a host of settings that can either be placed in the settings.json file in the workspace or can be edited through the Settings Editor UI.

According to the blog post, the new Pylance extension is complementary to the Python extension for Visual Studio Code. You can easily try the Pylance by downloading the Python extension straight from the Visual Studio Code marketplace.

Features of Pylance

Pylance provides performant language support, and it leverages Microsoft’s open-source static type checking tool, Pyright, in order to provide performant language support for Python language.

Pylance provides several intuitive features for Python 3 that include docstrings, parameter suggestions, code completion, auto-imports, as-you-type reporting of code errors and warnings, code outline, code navigation, code lens, type checking mode, IntelliCode, Jupyter notebook’s compatibility, and multi-root workspace support among others. 

Some of the features of this new language server are mentioned below: –

Optimised Performance

Pylance supercharges the Python IntelliSense experience with rich type information and helps a developer to write better code quickly. The Pylance extension is also dispatched with a cluster of type stubs for modules that provide fast and accurate auto-completion and type checking.

Type Information

Type information is now made available in function signatures. While hovering on symbols, Pylance provides a user with helpful data to assure that the user is correctly invoking functions to improve code quality. 

Auto-Imports

Auto-Imports is one of the most requested features of Pylance. This feature allows you to get smart import suggestions of installed and standard library modules for autocompletion.

Type Checking Diagnostics

The type checking mode in Pylance can be used by setting python.analysis.typeCheckingMode to basic or strict mode. The setting uses Pyright’s type checking to apply either a basic or comprehensive set of rules over your codebase, respectively. And the diagnostics produced from these modes can help improve the quality of your code and help you find edge cases easily.

Multi-Root Workspace Support

Pylance assists multi-root workspaces in a very naive manner. This means that a user can open more than one folder in the same Visual Studio Code session and also have Pylance functionality in each of the folders.

Wrapping Up

According to the developer of the tech giant, this new Python language support represents a drastic improvement for the Python experience on Visual Studio Code. According to the blog post, the new, free language server offers increased performance and many more features.

Currently, in the short term plan, a user will still be able to use the Microsoft Python Language Server as a choice of language server when writing Python in Visual Studio Code. While in the long term plan, the developers are planning to transition the Microsoft Python Language Server users over to Pylance and eventually deprecate and remove the old language server as a supported option.

Share
Picture of Ambika Choudhury

Ambika Choudhury

A Technical Journalist who loves writing about Machine Learning and Artificial Intelligence. A lover of music, writing and learning something out of the box.
Related Posts

CORPORATE TRAINING PROGRAMS ON GENERATIVE AI

Generative AI Skilling for Enterprises

Our customized corporate training program on Generative AI provides a unique opportunity to empower, retain, and advance your talent.

Upcoming Large format Conference

May 30 and 31, 2024 | 📍 Bangalore, India

Download the easiest way to
stay informed

Subscribe to The Belamy: Our Weekly Newsletter

Biggest AI stories, delivered to your inbox every week.

AI Courses & Careers

Become a Certified Generative AI Engineer

AI Forum for India

Our Discord Community for AI Ecosystem, In collaboration with NVIDIA. 

Flagship Events

Rising 2024 | DE&I in Tech Summit

April 4 and 5, 2024 | 📍 Hilton Convention Center, Manyata Tech Park, Bangalore

MachineCon GCC Summit 2024

June 28 2024 | 📍Bangalore, India

MachineCon USA 2024

26 July 2024 | 583 Park Avenue, New York

Cypher India 2024

September 25-27, 2024 | 📍Bangalore, India

Cypher USA 2024

Nov 21-22 2024 | 📍Santa Clara Convention Center, California, USA

Data Engineering Summit 2024

May 30 and 31, 2024 | 📍 Bangalore, India

Subscribe to Our Newsletter

The Belamy, our weekly Newsletter is a rage. Just enter your email below.