Home>Article>Backend Development> What about editor vs
VScode is a lightweight editor launched by Microsoft. Its functions are similar to Atom, Sublime Text, and Vim. It can be configured into a suitable IDE.
1. Software download and installation
VScode download address: https://code.visualstudio.com/
VScode’s github project address (not used in this article to): https://github.com/microsoft/vscode
Python download address: https://www.python.org/downloads/
The author uses the win version of VScode1 .0 and 32-bit Python2.7. When installing Python, be sure to add Python to the system environment variable
2. Introduction to the VScode project structure
VScode uses projects named by folders, that is If you want to write a program, you need to create a new folder as your project. This folder contains your source files. If you need to run it, you also need to create a new .vscode folder under this folder and configure it under the .vscode folder. How this project works.
The following is a typical project structure
├─Project name
│ │ Source file 1
│ │ Source file 2
│ │ ……
│ │ Source file n
│ │
│ └─.vscode
│ │ Tasks.json
│ Settings.json
This time there are more configuration pits, vSCODE recommends changing the region to EN-US, otherwise, some ordered you must play Chinese, do not play English, Chinese show English results, play English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English, English in English. no result.
Of course, this article has not changed the region
3. Install the Python plug-in
Installing the Python plug-in can realize some functions of syntax prompts. It is recommended to install it.
Open VScode, view -->Command Panel (Ctrl Shit P), enter ext install (Chinese input: extension, then select extension: install extension), select Python in the search results that appear, and click The little cloud on the right is ready for installation.
4. Create a new project and edit source code
To create a new project is to create a new folder. The author first creates a new PythonProject01 folder on the D drive (this step is built in the system, not in VScode ), click the Resource Manager button in VScode, click the blue open folder button
Find the newly created folder on the D drive, and click to select the folder
Click the button to create a new file and fill in the file name hello.py
Enter the following code in the editing window on the right and save it
# -*- coding: UTF-8 -* -
print "Hello, World!"
print "Hello, World!"
5. Edit the task.json task file and run the program
View-->Command Panel (Ctrl Shit P), enter Tasks: Configure Task Runner (Chinese input: task, then select Task: Configure Task Runner), select Other
At this time VScode will automatically Generate the .vscode folder and generate a default task.json
Change the task.json content to the following and save it
{
// See http:// go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command":"python",
//"command":"D:\\Python27\\python.exe",
"isShellCommand": true,
//"args": ["${file}"], //This way of writing cannot be compiled
"args": ["hello.py"],
"showOutput ": "always"
}
The running method is as follows:
View-->Command Panel (Ctrl Shit P), enter Tasks: Run Build Task (Chinese input :Task, and then select the task: Run the build task (Ctrl Shit B))
The results are as follows:
Attachment: Change the language to en-US
Ctrl Shit P, Enter the language (Language), select the configuration language (Configure Language), the location.json file will automatically appear
Add "locale":"en-US" as shown below, save it
{
// Define the display language of VSCode.
// See http://go.microsoft.com/fwlink/?LinkId=761051 for a list of supported languages.
// To change the value you need to restart VSCode.
"locale":"en-US"
}
Just restart VScode.
If you want to change back to Chinese, change it to "locale":"zh-CN" or delete the location.json file.
The above is the detailed content of What about editor vs. For more information, please follow other related articles on the PHP Chinese website!