Python in Visual Studio Code – August 2018 Release
We are pleased to announce that the August 2018 release of the Python Extension for Visual Studio Code is now available. 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 in Visual Studio Code in the VS Code documentation.
In this release we have closed a total of 38 issues including the stable release of our ptvsd 4 debugger, improvements to the language server preview, and other fixes.
Faster, more reliable debugging with ptvsd 4
In this release we are updating all users to the ptvsd 4.1.1 version of our Python debugger, providing a significant improvement to debugging performance and stability over the previous ptvsd 3.0 version. We originally announced an opt-in preview of ptvsd 4 in the February release of the Python extension, and have been continuing to improve on it based on user feedback. The new debug engine is built on top of the open source pydevd, which has allowed us to take advantage of its superior performance and support for third party libraries.
The new Python debugger supports the Logpoints feature added in the March iteration of VS Code. Logpoints allow you to essentially add print statements without having to stop execution. You can right-click on the margin and select “Add Logpoint…”, and then type in your message:
Remote debugging is easier to use and improved; previously you had to install the exact version of ptvsd used in VS Code on the remote server, and you needed to modify your code to enable the debugger to attach.
Now you can install any 4.x version of ptvsd and can enable attach from the command line. To install ptvsd and start remote debugging from the command line:
pip install --upgrade ptvsd
python3 -m ptvsd --host 22.214.171.124 --port 3000 -m myproject
Once the server starts you can attach to it from VS Code by modifying your launch.json file and setting the host and port number in the attach configuration. Check out our updated remote debugging documentation for more information.
We are continuing to make improvements to the debugger, so stay tuned in our future releases.
Improvements to the Language Server Preview
In the July release of the Python extension we added a preview of the Microsoft Python Language Server, our Python analysis engine from Visual Studio hosted inside of VS Code. This allowed us to provide faster & richer completions including support for typeshed definitions. We have made the following improvements in this release:
- Language server now populates document outline with all symbols instead of just top-level ones. (#2050)
- Fixed issue in the language server when documentation for a function always produced “Documentation is still being calculated, please try again soon”. (#2179)
- Fix null reference exception in the language server causing server initialization to fail. The exception happened when search paths contained a folder that did not exist. (#2017)
- Fixed language server issue when it could enter infinite loop reloading modules. (#2207)
- Language server now correctly handles
__enter__is declared in a base class. (#2240)
- Fixed issue in the language server when typing dot under certain conditions produced null reference exception. (#2262)
- Language server now correctly merges data from typeshed and the Python library. (#2345)
- Code lenses now appear for unit tests when using the language server (#1948)
Various Fixes and Enhancements
We have also added 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 changelog, some notable improvements are:
- Ensure test count values in the status bar represent the correct number of tests that were discovered and run. (#2143)
- Ensure workspace
pipenvenvironment is not labeled as a
virtual env. (#2223)
visualstudio_py_testLauncherto stop breaking out of test discovery too soon. (#2241)
- Fix error when switching from new language server to the old
Jedilanguage server. (#2281)
- Ensure stepping out of debugged code does not take user into
PTVSDdebugger code. (#767)