Vscode installation Use (Python)

Source: Internet
Author: User

One
https://code.visualstudio.com/

Second, install the Python plugin
Open Vscode,ctrl+p
Enter "ext install python", the search time may be longer
Select the most downloaded plugin click Install

To this side vscode can edit the Python code, edit the code by F5 to run. The first run will allow you to choose the environment and Python.
The default press F5 after the need to press the F5 program to run, if you want to press F5 run immediately need to Launch.json file "Stoponentry": true, Change to "Stoponentry": false.
Introduce a plugin, vscode-icons can make Vscode to the left of the explorer based on the file type display icon

Third, configuration Flake8
When you write code after installing Flake8, the editor will prompt you for errors, and the code format will prompt

Open command Line
Enter "Pip Install Flake8"
After the installation of Flake8 is successful, open Vscode, file, preferences, user settings, enter "Python.linting.flake8Enabled" in the Settings.json file: True

Iv. Configuration Yapf
Automatically format code by pressing ALT+SHIFT+F in Vscode after installing YAPF

Open command Line
Enter "Pip Install YAPF"
After the installation of YAPF is successful, open Vscode, file, preferences, user settings, enter "Python.formatting.provider" in the Settings.json file: "Yapf"

Five, a few tips
1. View the definition of a function or class
CTRL + left mouse click on the function name or class name to jump to the definition, the function name or the class name by pressing F12 can also achieve the same function
2. Change the variable name
Rename a variable by pressing F2 on the variable name
3. Python Breakpoint debugging
Click on the left side of the line number to set breakpoints, and on the left side of the debug screen you can see the variable changes
4. Hide the menu bar
This is a personal habit, if you also feel that the menu bar is very annoying, you can click on the view---toggle menu bar, can hide the menu bar. Press the ALT key when you need the menu bar to view
5. Set shortcut keys
File, preferences, keyboard shortcuts, copy the contents of the entire curly brace of the desired modifier shortcut to the right Keybindings.json file, and then modify the value of "key" to the shortcut you need. I only modified the shortcut keys for copying one row and deleting a row.

Vscode installation Use (Python)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.