"
Computer ProgrammingInternetUncategorized

New Python Features in Visual Studio Code 2022

New Python Features in Visual Studio Code 2022

New Python Features in Visual Studio Code 2022 – The Python extensions for Visual Studio Code’s December 2022 release are now available, according to a statement from Microsoft on its developer blogs website. Although these extensions are still in the pre-release phase, anyone can test them out. Here are the features of this December 2022 release.

1. Auto Indentation With Pylance

Every New Feature in Python in Visual Studio Code's 2022 Release

n the Pylance addon, an auto-indent functionality has been included. The appropriate indentations in your code are generated automatically by this functionality. This enables programmers to spend more time on the logic and less time on formatting of their code. It’s available for testing in VS Code – Insiders (registration required).

Go to the store and install the Pylance plugin after installing VS Code Insiders. Open User Settings by choosing View > Command Palette, Preferences, and pressing Enter (JSON). Verify the editor.formatOnType setting is true. It regulates whether a line of code will be automatically formatted by the editor after entering.

Every New Feature in Python in Visual Studio Code's 2022 Release
{
    "workbench.colorTheme": "Default Dark+",
    "[python]": {
        "editor.formatOnType": true
    },
    "python.defaultInterpreterPath": "C:\\New folder\\python.exe"
}

Write your code now to take use of this new functionality once it is set to true.

2. Python for the Web Extension

You can now execute and debug Python code in the browser thanks to this new VS Code plugin. The engine for execution is WebAssembly. Because it is still in the experimental stage, you shouldn’t use it to build Python for production usage. The steps are as follows to begin utilizing it:

Read also: First Line of Defense Against Email Security Threats

  1. Open a Chrome-based browser
  2. Using the following address, find your GitHub repository.
    https://insiders.vscode.dev/github/{username}/{repo}?vscode-coi=. Enter your GitHub login and repository in place of the username and repo parts, respectively. The result must look like the example below.

3. Install the Experimental – Python for the Web extension from the market.

4. Open your Python file.

5. To run the code without debugging, use CTRL+F5 or press F5.

Limitations of the Python for the Web Extension

The Python for the Web extension, as previously mentioned, is experimental and as such has some restrictions.

Read also: 9 Tips to stay Happy Everyday

  1. The majority of plugins and extensions for Intellisense are not supported by Python for the web. The ones that are not available are denoted by a warning sign, as is seen below.
  2. The web version’s Python interpreter has the following restrictions.
  • Pip is not supported
  • Socket is not supported
  • native Python modules are not supported
  • Thread & async is not supported either.

As a result, you should only utilize this functionality in test settings and prototype applications.

3. The Ruff Extension

Every New Feature in Python in Visual Studio Code's 2022 Release

The Ruff linter is supported by this addon. The Quick Remedy actions it offers, which will immediately fix infractions that can be fixed automatically, are its most astonishing feature. You may test the Ruff extension without using the VS Code insiders. It may also be installed using the regular version of VS Code. Install it from the VS Code marketplace to give it a try.

When you update or open a Python file, it runs on your code to correct the errors. Use it by doing the actions listed below:

  1. Launch Visual Studio Code
  2. Create a new Python file and start writing your code
  3. Open the Python source file you previously saved in Visual Studio Code.
  4. to run the Ruff extension, navigate to View > Command Palette, type Ruff, and run Ruff: Fix all auto-fixable problems.
  5. Ruff will correct all of your Python code’s auto-fixable faults after it has been run.

Final Words

Python development is now more productive on the platform thanks to the addition of new functionalities to Visual Studio Code extensions. You will spend more time concentrating on the logic of your code and less time thinking about the formatting of your code.

Additionally, open-source IDEs like Visual Studio Code frequently receive feature upgrades. This is a result of the enormous workforce employed in IDE development. The upgrades include additional features that improve the coding experience when using the IDEs.

New Python Features in Visual Studio Code 2022

Alex

Ugiankong David Ashipu, mostly known as Alex is a Nigerian content writer and graphic designer from the Cross River State. Instagram: @alexdave0 Whatsapp: 08123190001 Twitter: @Alexdave0

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button