Studying recently python, Always used before notepad++ As editor , By chance VSCode They are attracted by its beauty . After using it, I found that it starts quickly , Rich plug-ins , After downloading and installing, you can use it directly with little configuration , And support markdown. Of course , The most important thing is to look good :p design sketch :
hello_world.gif
VSCode Download address
install python plug-in unit
open VSCode,Ctrl+p
Input "ext install python", The search time may be long
Select the plug-in with the highest download volume and click Install ( According to the network , The installation time is uncertain , I've been a beginner for a long time , I have already downloaded it here, so it shows uninstall )
python Plug in installation .gif
This way VSCode You can edit python Code. , After editing the code, press F5 You can run . The first run will let you choose the environment , choice python that will do .
Press default F5 Then you need to press again F5 The program will run , If you want to press F5 Running right now requires that launch.json Of documents "stopOnEntry": true, Change it to "stopOnEntry": false.
Promote plug-ins ,vscode-icons You can make VSCode The Explorer on the left displays icons according to the file type
To configure flake8
install flake8 Later, when writing code, the editor will prompt where there is an error , If the code format is not standardized, it will also prompt
Open the command line
Input "pip install flake8"
install flake8 After success , open VScode, file -> Preferences -> User Settings , stay settings.json Enter... In the file "python.linting.flake8Enabled": true
flake8 To configure .png
flake8 design sketch .gif
To configure yapf
install yapf After the VSCode Press Alt+Shift+F You can format the code automatically
Open the command line
Input "pip install yapf"
install yapf After success , open VSCode, file -> Preferences -> User Settings , stay settings.json Enter... In the file "python.formatting.provider": "yapf"
yapf To configure .png
yapf design sketch .gif
A few tips
View the definition of a function or class Ctrl+ Click the function name or class name with the left mouse button to jump to the definition , Press... On the function name or class name F12 You can do the same thing
Change the variable name Press... On the variable name F2 You can rename variables
python Breakpoint debugging Click on the left side of the line number to set the breakpoint , In the debugging interface on the left, you can view the changes of variables
debug.png
Hide menu bar This is a personal habit , If you also feel that the menu bar is an eyesore , You can click to view -> Switch menu bar , You can hide the menu bar . Press... When you need the menu bar Alt Key to view
Set shortcut key file -> Preferences -> Keyboard shortcuts , Copy the contents of the whole brace of the shortcut key to be modified to the right keybindings.json In file , And then modify “key” The value of is the shortcut key you need . I only modified the shortcut keys for copying a row and deleting a row .
to update
2016-8-25 to update Introduce two plug-ins
Guides, Indent line plug-in , Make the code look clearer
vscode-todo, send VSCode Support TODO Plug in for
Last
You are welcome to point out what needs to be added or where there are mistakes (。・`ω´・)