Visual Studio Code Usage Tips

Source: Internet
Author: User
Tags json custom name

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.


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.