We've made 51 improvements in this release, including:
- Added support for a new language server: Pylance
- Gather Extension
- Exporting notebooks to HTML and PDF
- Connect back to the debugger
If you are interested, you can explore the full list of improvements in this list changes.
: Pylance
A couple of weeks ago, we announced the release of Pylance, our new language server based on Microsoft's Pyright static type checking tool .
Pylance is a fast language server that provides many features to help you write better code, including auto imports, dead code detection, parameter and return type information, support for a multi-root workspace, and more. You can read the Pylance blog post to learn more about this.
Pylance recently added a context highlighting feature that helps you quickly identify where symbols are being used in a particular file.
You can install the Pylance extension from the marketplace... If you have the Pyright extension installed, you should uninstall it in favor of the Pylance extension to avoid installation conflicts and duplicate errors and warnings, since all Pyright features are included in Pylance.
If you are a Microsoft Python Language Server user, we recommend that you try Pylance. The new language server significantly improves Python IntelliSense in VSCode. Because of this, the long term plan is to eventually ditch the Microsoft Python Language Server as a supported option in the Python extension.
Gather Extension
We are pleased to announce that this release is adding support for our new experimental extension, Gather. Gather is a recurring theme, and we look forward to community feedback to improve Gather's accuracy! This tool analyzes and identifies required code dependencies in notepad and performs code cleanup, thereby automating this complex and time-consuming task.
You can install Gather on the marketplace today . We'd love to hear your feedback! If you have any problems, feel free to register them in the vscode-python GitHub repository.
Export notebooks to HTML and PDF
This release includes support for exporting notebooks to HTML and PDF, making it easy to share and present notebooks with the click of a button!
Note that exporting to PDF requires TeX to be installed.
Connect back to the debugger
With this release, you can now more easily start remote debugger sessions using callback connections.
When connecting ptvsd - our Python debugger in VS Code - to a Python process or to a remote machine, you need to configure the remote Python process to listen for attach requests and then start a debugger session in VS Code to connect to that.
However, connecting can be tricky if you don't provide the correct time - the process may have taken a long time to run on the remote machine, or it may have timed out waiting for VS Code to connect to it.
In this release, we added support for setting up a debugger for connection back. You can now set up a remote Python process to connect to a specific address (port number or host and port tuple) and run the attach configuration in VS Code to start listening on the same address so it can connect to the process.
For example, you can run the following script:
import debugpy
debugpy.connect(('localhost',5678))
debugpy.breakpoint()
print("debugger stops here")
And then add the launch.json config to VS Code with the following content:
{
"name": "Python: Attach using listen",
"type": "python",
"request": "attach",
"listen": {
"host": "127.0.0.1",
"port": 5678
},
},
You can now start the debugger in VS Code so that it starts listening for the connection request. When you start a Python process, it stops at a specific breakpoint.
Be sure to download the Visual Studio Code Python extension now to try out the above improvements. If you run into any problems or have suggestions, please report it on the Python VS Code GitHub page .