{"id":6815,"date":"2018-10-09T10:00:29","date_gmt":"2018-10-09T17:00:29","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/python\/?p=6815"},"modified":"2019-02-17T15:26:55","modified_gmt":"2019-02-17T22:26:55","slug":"python-in-visual-studio-code-september-2018-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-september-2018-release\/","title":{"rendered":"Python in Visual Studio Code \u2013 September 2018 Release"},"content":{"rendered":"<p>We are pleased to announce that the September 2018 release of the Python Extension for Visual Studio Code is now available. You can\u00a0<u><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\">download the Python extension<\/a><\/u>\u00a0from the marketplace, or install it directly from the extension gallery in Visual Studio Code. You can learn more about\u00a0<u><a href=\"https:\/\/code.visualstudio.com\/docs\/languages\/python\">Python support in Visual Studio Code<\/a><\/u>\u00a0in the documentation.<\/p>\n<p>In this release we have closed a total of 45 issues, including:<\/p>\n<ul>\n<li>Automatic activation of environments in the terminal.<\/li>\n<li>Support for Python environments in split terminals.<\/li>\n<li>Debugger support for the breakpoint() built-in.<\/li>\n<li>Improved Go To Definition and find all references in the Python Language Server.<\/li>\n<li>Reduced CPU and Memory consumption in the Python Language Server.<\/li>\n<\/ul>\n<p>Also be sure to check out the\u00a0<a href=\"https:\/\/code.visualstudio.com\/updates\/v1_28\">September Update to Visual Studio Code<\/a>, which includes a new custom title and menu bar on windows and the tutorial on how to\u00a0<a href=\"https:\/\/code.visualstudio.com\/docs\/python\/tutorial-django?utm_source=VsCode&amp;utm_medium=ReleaseNotes\">Use Django in Visual Studio Code<\/a>.<\/p>\n<h2><strong>Automatic Activation of Environments in the Terminal<\/strong><\/h2>\n<p>When you create a new terminal, the extension now automatically activates the selected Python pipenv, conda, pyenv, or virtual environment so that you can run python and pip\/conda commands. In the below screenshot we have the &#8216;env&#8217; virtual environment\u00a0selected (as indicated in the status bar) and then created a new terminal using\u00a0<strong>Terminal &gt; New Terminal\u00a0<\/strong>(Ctrl+Shift+`), and the virtual environment is activated automatically when the terminal is created:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6816\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/1_ActivatedTerminal.png\" alt=\"\" width=\"993\" height=\"296\" srcset=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/1_ActivatedTerminal.png 1972w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/1_ActivatedTerminal-300x89.png 300w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/1_ActivatedTerminal-768x229.png 768w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/1_ActivatedTerminal-1024x305.png 1024w\" sizes=\"(max-width: 993px) 100vw, 993px\" \/><\/p>\n<p>You no longer need to use the\u00a0<em>Python: Create Terminal<\/em>\u00a0command to create an activated Python terminal (terminals with a Python environment activated).<\/p>\n<p>It is also possible to use activated Python terminals in split terminal mode.\u00a0\u00a0The extension uses the selected Python environment at the time the terminal is created, so if you want to have terminals with two different environments activated, you can change your environment and create a new terminal.<\/p>\n<p>The screenshot below shows two different Python environments side-by-side terminals, resulting from clicking on the Python interpreter in the status bar and changing it to &#8216;otherenv&#8217; and then clicking the split icon in the terminal:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6817 \" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/2_SideBySideTerminals.png\" alt=\"\" width=\"992\" height=\"257\" srcset=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/2_SideBySideTerminals.png 2254w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/2_SideBySideTerminals-300x78.png 300w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/2_SideBySideTerminals-768x199.png 768w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/2_SideBySideTerminals-1024x265.png 1024w\" sizes=\"(max-width: 992px) 100vw, 992px\" \/><\/p>\n<p>The extension now shows the name of the environment in the status bar, making it easy to determine which environment is active if you have multiple environments in your workspace.<\/p>\n<p>If you are not seeing your environment selected, you may need to first open a Python file to load the Python extension, or if the terminal was created before an environment was selected you may need to create a new terminal. Note that global interpreters do not get activated in terminals, so you&#8217;ll need to run those using e.g. python3 (Linux\/macOS) or py -3 (Windows).<\/p>\n<h2><strong>Debugger Improvements<\/strong><\/h2>\n<p>The debugger now supports the breakpoint() built-in in Python 3.7. If you are on Python 3.7 you can add a breakpoint() call, and the debugger will automatically stop on that line when it is hit (you must already be running under the debugger for this functionality; it will not launch the debugger automatically for you).<\/p>\n<p>In the below example the debugger stops on a breakpoint() call inside of a Django view:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6818 \" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/3_breakpoint.png\" alt=\"\" width=\"888\" height=\"304\" srcset=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/3_breakpoint.png 1139w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/3_breakpoint-300x103.png 300w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/3_breakpoint-768x263.png 768w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/3_breakpoint-1024x351.png 1024w\" sizes=\"(max-width: 888px) 100vw, 888px\" \/><\/p>\n<p>The extension now displays auto-complete for expressions typed into the debug console, after hitting the above breakpoint we can get auto-complete for the request object in the debug-console:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6820 \" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/5_debug_autocomplete.png\" alt=\"\" width=\"765\" height=\"393\" srcset=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/5_debug_autocomplete.png 1117w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/5_debug_autocomplete-300x154.png 300w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/5_debug_autocomplete-768x395.png 768w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/5_debug_autocomplete-1024x526.png 1024w\" sizes=\"(max-width: 765px) 100vw, 765px\" \/><\/p>\n<h2>Improvements to Language Server Preview<\/h2>\n<p>We&#8217;ve made improvements to the preview of the Microsoft Python Language Server, first released in the\u00a0<a href=\"https:\/\/devblogs.microsoft.com\/python\/2018\/07\/18\/python-in-visual-studio-code-june-july-2018-release\/\">July release of the Python extension<\/a>. In this release we have fixed cases where runaway CPU and Memory consumption caused by storing too many symbols, particularly when using the outline view, and fixed various issues where Find All References and Go to Definition weren\u2019t working as expected.<\/p>\n<p>Rename symbol is also available with the language server without installing rope, to rename a symbol right-&gt;click and select Rename Symbol (F2).<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-6819 \" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/4_renamesymbol.png\" alt=\"\" width=\"908\" height=\"300\" srcset=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/4_renamesymbol.png 1241w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/4_renamesymbol-300x99.png 300w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/4_renamesymbol-768x254.png 768w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/10\/4_renamesymbol-1024x338.png 1024w\" sizes=\"(max-width: 908px) 100vw, 908px\" \/><\/p>\n<p>As a reminder, to opt-in to the language server, change the\u00a0<strong>python.jediEnabled<\/strong>\u00a0setting to\u00a0<strong>false<\/strong>\u00a0in\u00a0<strong>File &gt; Preferences &gt; User Settings<\/strong>. We are working towards making the language server the default in future releases.<\/p>\n<h2>Various Fixes and Enhancements<\/h2>\n<p>This release includes a number of other fixes an enhancements to the Python extension, the\u00a0<a href=\"https:\/\/github.com\/Microsoft\/ptvsd\/releases\/tag\/v4.1.3\">ptvsd 4.1.3<\/a>\u00a0release of the debugger, and the\u00a0<a href=\"https:\/\/github.com\/Microsoft\/python-language-server\/releases\/tag\/2018.9.0\">Microsoft Python Language Server 2018.9.0 release<\/a>. The full list is improvements is available in our\u00a0<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/blob\/master\/CHANGELOG.md#201890-9-oct-2018\">changelog<\/a>, some notable ones include:<\/p>\n<ul>\n<li>Files on network drives can now be debugged.\u00a0<a class=\"issue-link js-issue-link tooltipped tooltipped-ne\" href=\"https:\/\/github.com\/Microsoft\/ptvsd\/issues\/786\">#786<\/a>,\u00a0<a class=\"issue-link js-issue-link tooltipped tooltipped-ne\" href=\"https:\/\/github.com\/Microsoft\/ptvsd\/issues\/817\">#817<\/a><\/li>\n<li>Support for code completion in the debug console window. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1076\">#1076<\/a>)<\/li>\n<li>Display notification when attempting to debug without selecting a python interpreter. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/2494\">#2494<\/a>)<\/li>\n<li>Add support for activation of\u00a0<code>pyenv<\/code>\u00a0environments in the Terminal. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1526\">#1526<\/a>)<\/li>\n<li>Search for default known paths for conda environments on windows. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/2794\">#2794<\/a>)<\/li>\n<li>Use full path to activate command in conda environments on windows when python.condaPath is set. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/2753\">#2753<\/a>)<\/li>\n<\/ul>\n<p>Be sure to\u00a0<a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\">download the Python extension<\/a>\u00a0for VS Code now to try out the above improvements. If you run into any issues be sure to file an issue on the\u00a0<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/milestone\/3\">Python VS Code GitHub<\/a>\u00a0page.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are pleased to announce that the September 2018 release of the Python Extension for Visual Studio Code is now available. In this release we have closed a total of 45 issues, including automatic activation of environments in the terminal, support for Python environments in split terminals, debugger support for the breakpoint() built-in, improved Go To Definition and Find References in the Python Language Server, reduced CPU and Memory consumption in the Python Language Server.<\/p>\n","protected":false},"author":883,"featured_media":6818,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-6815","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio-code"],"acf":[],"blog_post_summary":"<p>We are pleased to announce that the September 2018 release of the Python Extension for Visual Studio Code is now available. In this release we have closed a total of 45 issues, including automatic activation of environments in the terminal, support for Python environments in split terminals, debugger support for the breakpoint() built-in, improved Go To Definition and Find References in the Python Language Server, reduced CPU and Memory consumption in the Python Language Server.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/6815","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\/883"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/comments?post=6815"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/6815\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media\/6818"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media?parent=6815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/categories?post=6815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/tags?post=6815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}