{"id":2195,"date":"2018-05-02T10:33:32","date_gmt":"2018-05-02T17:33:32","guid":{"rendered":"http:\/\/blogs.msdn.microsoft.com\/pythonengineering\/?p=2195"},"modified":"2019-02-17T15:26:59","modified_gmt":"2019-02-17T22:26:59","slug":"python-in-visual-studio-code-april-2018-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-april-2018-release\/","title":{"rendered":"Python in Visual Studio Code \u2013 April 2018 Release"},"content":{"rendered":"<p>We are pleased to announce that the April 2018 release of the Python Extension for Visual Studio Code is now available from the marketplace and the gallery. You can <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\">download the Python extension<\/a> from the marketplace, or install it directly from the extension gallery in Visual Studio Code. You can learn more about <a href=\"https:\/\/code.visualstudio.com\/docs\/languages\/python\">Python support in Visual Studio Code<\/a> in the VS Code documentation.<\/p>\n<p>In this release we have <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/milestone\/5?closed=1\">closed a total of 110 issues<\/a> including remote debugging support in the Preview debugger, and enhancements to running Python code in the terminal.<\/p>\n<h2>Improvements to Running Python Code in the Terminal<\/h2>\n<p>We\u2019ve made various improvements that make it easier to run Python code in the terminal.<\/p>\n<p>A <strong>Ctrl+Enter<\/strong> keyboard shortcut has been added for the \u201cPython: Run Line\/Selection in terminal\u201d command. The command was also enhanced so that it adds and removes blank lines in indented code blocks so that they will run correctly in the terminal.<\/p>\n<p>Take the following code example:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/12\/2019\/02\/1_Selection.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/05\/1_Selection-2.png\" alt=\"\" class=\" wp-image-2205 aligncenter\" width=\"251\" height=\"181\" \/><\/a><\/p>\n<p>Previously this code would not have run properly in the terminal because the blank line in between the two print statements would cause an indentation error when running the second print function, and a blank line is needed to finish the indentation block before running the third print function.<\/p>\n<p>Now the blank line is removed in between the two print function calls, a blank line is added before the third print function call, and the code is successfully run in the terminal when pressing <strong>Ctrl-Enter<\/strong>:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/12\/2019\/02\/2_RunInTerminal.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/05\/2_RunInTerminal-1.png\" alt=\"\" class=\" wp-image-2215 aligncenter\" width=\"254\" height=\"184\" \/><\/a><\/p>\n<p>When using the &#8220;Python: Create Terminal&#8221; command, the focus is put into the terminal so you no longer need to use the mouse to click into the window before you start typing. The &#8220;Run Python File in Terminal&#8221; command (available on the context menu in the file explorer, or in the command palette) now saves the file before running it, avoiding confusion from running code that doesn\u2019t match what is shown in the editor.<\/p>\n<h2>Remote Debugging Support in Preview Debugger<\/h2>\n<p>We are continuing to add features to our Preview debugger, in this release we added remote debugging capabilities. The Preview debugger was first added in the <a href=\"https:\/\/devblogs.microsoft.com\/python\/2018\/03\/08\/python-in-visual-studio-code-feb-2018-release\/\">February release of the extension<\/a>, and will provide significantly better debugging performance and reliability when it becomes stable.<\/p>\n<p>To use remote debugging, you first need to install the preview version of ptvsd using:<\/p>\n<pre>pip install ptvsd --pre<\/pre>\n<p>Then you can start the debug server in one of two ways, by using the following command to start a python file:<\/p>\n<pre>python -m ptvsd --server --port 9091 --file module.py<\/pre>\n<p>Or you can import ptvsd into your app and start the server programmatically:<\/p>\n<pre>import ptvsd\nptvsd.enable_attach(('0.0.0.0', 5678))<\/pre>\n<p>Then you can add a remote attach configuration from the debugging configuration drop-down and enter the port and IP address to use:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/12\/2019\/02\/3_RemoteAttach.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2018\/05\/3_RemoteAttach-2.png\" alt=\"\" class=\" wp-image-2225 aligncenter\" width=\"780\" height=\"326\" \/><\/a><\/p>\n<p>One improvement of remote debugging that you get with the Preview debugger is that you don\u2019t need to use the exact same ptvsd library version on the server that is used in VS Code going forward with ptvsd 4.<\/p>\n<p>To try out the preview version of the debugger, <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/538\">select Python Experimental debugger type when you start debugging<\/a>, or when adding debug configurations.<\/p>\n<h2>Various Fixes and Enhancements<\/h2>\n<p>We have also fixed several small enhancements and fixed issues requested by users that should improve your experience working with Python in Visual Studio Code. The full list of improvements is listed in our <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/blob\/master\/CHANGELOG.md\">changelog<\/a>, some notable issues are:<\/p>\n<ul>\n<li>Fix &#8220;Go to definition&#8221; functionality across files. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1033\">#1033<\/a><span>)<\/span><\/li>\n<li>IntelliSense improvements from upgrading to Jedi version 0.12.0 and various fixes for completions and go to definition (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1072\">#1072<\/a>, <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/178\">#178<\/a>, <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/142\">#142<\/a>, <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/344\">#344<\/a>, <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/338\">#338<\/a>)<\/li>\n<li>Improvements to formatting as you type when editor.formatOnType\u00a0is on (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/726\">#726<\/a>, <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1257\">#1257<\/a>, <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1257\">#1257<\/a>, <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1364\">#1364<\/a>)<\/li>\n<li>Improvements to interpreter selection\/display (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1015\">#1015<\/a>, <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1192\">#1192<\/a>, <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1254\">#1254<\/a>, <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1305\">#1305<\/a>)<\/li>\n<li>Add support for\u00a0<a href=\"https:\/\/code.visualstudio.com\/docs\/editor\/debugging#_logpoints\">logpoints<\/a>\u00a0in the preview debugger. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1306\">#1306<\/a>)<\/li>\n<li>Enable debugging of Jinja templates (outside of Flask apps) in the preview debugger.\u00a0(<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1492\">#1492<\/a>)<\/li>\n<li>Add support for\u00a0<a href=\"https:\/\/code.visualstudio.com\/docs\/editor\/debugging#_advanced-breakpoint-topics\">hit count breakpoints<\/a>\u00a0in the preview debugger. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/1409\">#1409<\/a>)<\/li>\n<li>Support for using the preview debugger when debugging Python Unit Tests. To enable this, set the <em>python.unitTest.useExperimentalDebugger<\/em> setting to <em>true.<\/em> (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/906\">#906<\/a>)<\/li>\n<\/ul>\n<p>Be sure to <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\">download the Python extension<\/a> for VS Code now to try out the above improvements. If you run into any issues be sure to file an issue on the <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/milestone\/3\">Python VS Code GitHub<\/a> page.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are pleased to announce that the April 2018 release of the Python Extension for Visual Studio Code is now available from the marketplace and the gallery. You can download the Python extension from the marketplace, or install it directly from the extension gallery in Visual Studio Code. You can learn more about Python support [&hellip;]<\/p>\n","protected":false},"author":883,"featured_media":10119,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[19],"class_list":["post-2195","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-visual-studio-code"],"acf":[],"blog_post_summary":"<p>We are pleased to announce that the April 2018 release of the Python Extension for Visual Studio Code is now available from the marketplace and the gallery. You can download the Python extension from the marketplace, or install it directly from the extension gallery in Visual Studio Code. You can learn more about Python support [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/2195","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=2195"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/2195\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media\/10119"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media?parent=2195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/categories?post=2195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/tags?post=2195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}