Using Python in Visual Studio Code? Microsoft has new toys for you
You will use the new debugger and you will like it, OK?
Microsoft has updated the Python Extension for Visual Studio Code, giving devs some new debugging toys and a beefed-up language server.
Visual Studio Code is a free and open-source code editor, based on Electron, and much beloved by developers (at least according to Stack Overflow). Python is one of the many languages supported via a range of extensions and plugins.
The latest update for the Python extension has seen Microsoft forcibly moving coders to version 4.1.1 of its Python Tools for Visual Studio debug server (ptvsd), having slung out an opt-in preview of the tech in February. The Register took the new debugger for a spin and can confirm that performance is markedly improved over version 3. Redmond also claimed improvements have been made in stability.
One particularly useful feature of the new debugger is support for LogPoints, which made an appearance in Code back in March for Node.js. Allowing a developer to log a message to the console without "breaking" into the debugger, LogPoints is massively handy when sticking logging into code that really shouldn't be stopped.
Dealing with remote debugging will also be less of a headache since devs need now only ensure
ptvsd is on both computers and attach via an open port. Previously the exact same version of
ptvsd was required with code modifications to allow the debugger to attach. Now, in the brave new world of v4, the command line will be your friend.
The other major tweak in the update comes in the form of improvements to the Microsoft Python Language Server.
Still in preview, the tech will likely be sneered at by "proper" programmers, but is an absolute boon for the likes of your humble Reg hack struggling to keep track of variables and context, as well as the inevitable syntax errors. Among the raft of fixes, the update has seen the server populating the document outline with all symbols rather than the top-level ones and dealt with an embarrassing infinite loop during module reload under certain conditions. ®