Recently in using vs Code as editor.
It's good to use, and here are some tips for using it.
VS Code's official website:
Https://www.visualstudio.com/en-us/products/code-vs.aspx
VS code's official Basic tutorial:
Https://code.visualstudio.com/docs/c?utm_expid=101350005-20.jAsCkEFcTeqvtdr0STCN9g.2&utm_referrer=https%3A %2f%2fwww.visualstudio.com%2fen-us%2fproducts%2fcode-vs.aspx
Common shortcut keys
Ctrl +/: quickly annotate or uncomment;
Ctrl + O: Opens the directory where the current file is located;
Ctrl + P: Opens a window that jumps to a file;
File Filtering
VS code displays all files by default, but some of these files are not viewable, such as. o files.
It is best to filter out these files and not display them in the sidebar.
To do this, you can open the user settings, preferences, file, and then in the edit box, the default settings file and the Setting.json file are skipped.
The default settings file is not modifiable and we need to overwrite the default settings on the Setting.json file as follows:
On the far right is the setting file, which adds the following code:
Put the settings in this file to override the default settings
{
//configure USR mode to exclude files and folders.
"Files.exclude": {
"**/.git": True,
"**/.SVN": True,
"**/.HG": True,
"**/." Ds_store ": True,
" **/*.O ": True,
" **/*.o.cmd ": True
}
}
Files.exclude is the filter file settings, here the first 4 is the default, the following two is new.
"**/*.O": True,
"**/*.o.cmd": True
Indicates that all files ending with. O and. O.cmd are ignored. This will not show these files in vs code.
You can also control not displaying folders, such as
"**/build": True
This is where the build folder is hidden.
Setting.json can also be used for various settings, you can see the default settings on the left to make customized changes.
using vs code for Python debugging
1) First you need to download the Python plugin:
Click on the section in the Red box, you can choose a different plug-in, which is already installed after the Python plugin results.
2) then select "File--preferences--user settings" to open Settings.json this profile.
You can find the Python.pythonpath in the default configuration and you need to modify the Python location of the cost machine in Settings.json:
3) Open the folder where the Python file is located and you are ready to debug:
Note that it is no use to open the file, you must open the directory where the file is located.
VS code also creates a. Vscode directory under this directory, which contains the configurable file Launch.json.
Custom Code Snippets
Selecting the user code snippet, file, preferences, will jump out the following window:
Select the following as needed, for example, to create a comment fragment, which can be selected in plain text.
To add a custom code snippet to an open Plaintext.json, here's an example:
Explanation of the Blue Character section:
Comment: The custom name, casually take, indicates the meaning of this code fragment can be;
Prefix: Shortcut field, enter the corresponding value in subsequent code editing, such as the CT here, will prompt the use of this code snippet;
Body: The actual content of the code fragment;
Description: Enter the comment in the hint that pops up after the prefix value.
Here are the actual effects that are used:
After you click Enter:
other
vs code Toggles line breaks, and common Windows and UNIX class systems use different line breaks, while the VS code is both supported and can be toggled at any other.
As shown in the red box in the lower right corner, the current line break is shown here, and left click here to set it.