{"id":8448,"date":"2021-05-13T09:59:49","date_gmt":"2021-05-13T17:59:49","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/python\/?p=8448"},"modified":"2021-05-13T09:59:49","modified_gmt":"2021-05-13T17:59:49","slug":"pylance-has-reached-stable","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/python\/pylance-has-reached-stable\/","title":{"rendered":"The Pylance language server has reached stable!"},"content":{"rendered":"<p><span data-contrast=\"auto\">We\u2019re excited to announce that Pylance, our fast and feature-rich language support for Python in Visual Studio Code, is now officially out of preview and has reached its first stable release. <\/span><\/p>\n<p><span data-contrast=\"auto\">Join us on <a href=\"https:\/\/aka.ms\/code-livestream-page\">Learn TV today (May 13, 2021) for a livestream event at 12:00pm PST<\/a>\u00a0to help us celebrate the launch and\u00a0for\u00a0an overview of the most performant and user-friendly editing experience for Python in VS Code ever.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Earlier this week,\u00a0<a href=\"https:\/\/aka.ms\/new-python-bundle\">we announced<\/a>\u00a0that as of the\u00a0May\u00a0release\u00a0of the Python extension,\u00a0Pylance is also now the default\u00a0Python\u00a0language server\u00a0in Visual Studio Code.\u00a0Pylance is also now\u00a0included in\u00a0the Python\u00a0core extension\u2019s bundle\u00a0as an optional dependency, meaning that we\u2019ll automatically install it for you, but you\u00a0have the option to use\u00a0another\u00a0language server of your\u00a0choice.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><strong>Background<\/strong><\/h2>\n<p>Last June, <a href=\"https:\/\/aka.ms\/announcing-pylance\">we released a public preview of a new Python language server<\/a>, Pylance, as a commitment to providing robust and performant language features to Python users in Visual Studio Code. Since Pylance\u2019s public preview, we\u2019ve received both praise and constructive feedback from the community which we have used to guide our work over the last eleven months.<\/p>\n<p>Today, we are pleased to announce that the core Pylance feature set has reached its stable release in Visual Studio Code!<\/p>\n<p>&nbsp;<\/p>\n<h2><strong>Overview of Pylance features<\/strong><\/h2>\n<p>Since our initial release, we\u2019ve continued to improve the performance and experience of several key features (e.g., completions, auto-imports, function signature help, docstrings), and added new features (e.g., extract variable and extract method code actions, contextual highlighting).<\/p>\n<p>If you aren\u2019t already a Pylance user, here\u2019s a quick overview of some of the rich features that the language server provides for Python development in Visual Studio Code.<\/p>\n<p>&nbsp;<\/p>\n<h3><strong>Auto-import completions<\/strong><\/h3>\n<p>With auto-imports, you can get smart import suggestions in your completions list for installed and standard library modules. Upon selection, the appropriate import will be added to the top of your file, so you don\u2019t have to scroll to the top and add it in manually. Auto-import completions also include a clear preview of the import statement that will be added to your file in the completion tooltip so you know exactly what symbol you are importing. If you have already imported other submodules or functions from that module, Pylance will amend the existing statement by adding the new symbol alphabetically, helping to keep your imports organized.<\/p>\n<p><strong><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/auto-import.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8457\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/auto-import.gif\" alt=\"Image auto import\" width=\"1200\" height=\"600\" \/><\/a>\n<\/strong><\/p>\n<h3><\/h3>\n<p>&nbsp;<\/p>\n<h3><strong>Function signature help with parameter and return type information<\/strong><\/h3>\n<p>Pylance provides a useful function signature tooltip which includes type information to help you properly invoke functions without needing to look at external documentation. Function signature help also handles functions with multiple overrides. You can navigate between signatures easily while Pylance bolds the appropriate active parameter.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/August2020-PylanceSignatureHelp.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8450\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/August2020-PylanceSignatureHelp.gif\" alt=\"Image August2020 PylanceSignatureHelp\" width=\"800\" height=\"400\" \/><\/a><\/p>\n<h3><\/h3>\n<p>&nbsp;<\/p>\n<h3><strong>Code navigation<\/strong><\/h3>\n<p>Pylance also provides performant code navigation functionality, like go to definition and go to declaration, to allow you to quickly jump to user-defined code, source files (e.g. .py) or type stub files (.pyi).<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/Feb2021-PylanceCodeNavUpdate.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8481\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/Feb2021-PylanceCodeNavUpdate.gif\" alt=\"Image Feb2021 PylanceCodeNavUpdate\" width=\"900\" height=\"450\" \/><\/a><\/p>\n<h3><\/h3>\n<p>&nbsp;<\/p>\n<h3><strong>Refactoring code actions \u2013 extract variable and extract method<\/strong><\/h3>\n<p>Pylance also provides you to use refactoring code actions which allows you to highlight lines of code and automatically refactor and extract them into new methods or variables at the click of a button!<\/p>\n<h4><strong>Extract Variable<\/strong><\/h4>\n<p><strong><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/Dec2020-PylanceExtractVariable-1.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8451\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/Dec2020-PylanceExtractVariable-1.gif\" alt=\"Image Dec2020 PylanceExtractVariable 1\" width=\"1200\" height=\"600\" \/><\/a>\n<\/strong><\/p>\n<h4><\/h4>\n<h4><strong>Extract Method<\/strong><\/h4>\n<p><strong><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/Dec2020-PylanceExtractMethod-1.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8452\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/Dec2020-PylanceExtractMethod-1.gif\" alt=\"Image Dec2020 PylanceExtractMethod 1\" width=\"1200\" height=\"600\" \/><\/a><\/strong><\/p>\n<h3><\/h3>\n<p>&nbsp;<\/p>\n<h3><strong>\nSemantic colorization<\/strong><\/h3>\n<p>Pylance\u2019s semantic colorization helps improve the readability and understanding of your code. If you are unfamiliar with semantic colorization, it\u2019s an extension on syntax highlighting. Pylance generates semantic tokens which are used by themes to apply colors based on the semantic meaning of symbols (e.g., variables, functions, modules all have distinct colors applied to them).<\/p>\n<p>To see this new feature in action, you will need to apply a theme that supports semantic color. Some great themes to try out semantic colorization are the built-in Dark+ theme or <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=zhuangtongfa.Material-theme\">One Dark Pro<\/a> used below.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/PylanceGA-SemanticColour.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8453\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/PylanceGA-SemanticColour.gif\" alt=\"Image PylanceGA 8211 SemanticColour\" width=\"1200\" height=\"600\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><strong>Contextual document highlighting<\/strong><\/h3>\n<p>Pylance supports contextual highlighting, which helps you quickly identify where symbols are used in a particular file.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/PylanceGA-ContextualHighlighting.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8454\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/PylanceGA-ContextualHighlighting.gif\" alt=\"Image PylanceGA 8211 ContextualHighlighting\" width=\"1200\" height=\"600\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><\/h3>\n<h3><strong>Type checking support via Pyright<\/strong><\/h3>\n<p>Because Pylance leverages our open-source type checker called <a href=\"https:\/\/github.com\/microsoft\/pyright\">Pyright<\/a>, the language server also comes with a built-in, static type checker if you are interested in writing typed Python. By default, no type checking functionality is enabled, and you\u2019ll only see diagnostics (errors and warnings) in your code when you have syntactically invalid Python. However, you can enable basic or strict type checking by configuring python.analysis.typeCheckingMode. This setting uses Pyright\u2019s type checking to apply either a basic or comprehensive set of rules over your codebase, respectively. The diagnostics produced from this mode can help improve the quality of your code and help you find edge cases more easily.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/PylanceGA-StrictTypeChecking.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8455\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/PylanceGA-StrictTypeChecking.gif\" alt=\"Image PylanceGA 8211 StrictTypeChecking\" width=\"1200\" height=\"600\" \/><\/a><\/p>\n<h3><\/h3>\n<p>&nbsp;<\/p>\n<h3><strong>I<\/strong><strong>ntelliCode compatibility<\/strong><\/h3>\n<p>Pylance is also fully compatible with IntelliCode, which brings recommended completions for your specific code context to the top of your completions list to further enhance your productivity!<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/PylanceGA-IntelliCodeCompat.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8456\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/05\/PylanceGA-IntelliCodeCompat.gif\" alt=\"Image PylanceGA IntelliCodeCompat\" width=\"1200\" height=\"600\" \/><\/a><\/p>\n<h2><\/h2>\n<p>&nbsp;<\/p>\n<h2><strong>Feedback<\/strong><\/h2>\n<p>If you have any questions, comments, or feedback on your experience, please reach out to us on\u00a0<a href=\"https:\/\/github.com\/microsoft\/pylance-release\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019re excited to announce that Pylance, our fast and feature-rich language support for Python in Visual Studio Code, is now officially out of preview and has reached its first stable release. Keep reading to learn more!<\/p>\n","protected":false},"author":33429,"featured_media":8458,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,6],"tags":[1252],"class_list":["post-8448","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-visual-studio-code","tag-pylance"],"acf":[],"blog_post_summary":"<p>We\u2019re excited to announce that Pylance, our fast and feature-rich language support for Python in Visual Studio Code, is now officially out of preview and has reached its first stable release. Keep reading to learn more!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/8448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/users\/33429"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/comments?post=8448"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/8448\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media\/8458"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media?parent=8448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/categories?post=8448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/tags?post=8448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}