vs code my journey into the pit


Share: environment configuration of VS Code

1. Installation and description of basic plug-ins

Chinese (Simplified) Language Pack for Visual Studio Code: Simplified Chinese code

Code runner: shortcut key for creating code submission

Dracula Official: dark theme (can be selected in settings)

Material Icon Theme: folder icon (can be selected in settings)

2. Font selection

It is recommended to use JetBrainsMono. The font is very beautiful. It can be added in the setting after installation

3. Kernel environment of several programming languages

IDE: intergrated development environment

Integrated development environment is what we often call compiler, such as visual studio of c/c + +, IDEA of java and pycharm of python

Its essence is to apply the kernel of programming language

c/c + + mingw64 java jdk python python

As a lightweight text editor, vs code aggregates many plug-ins to realize the programming of the native kernel

4. The first step is to create environment variables

Mingw64: create a path in the system variable path, and specify the path as bin in mingw64

jdk: there are two steps. First, create Java in the system variable_ Home, then create the path in the system variable path and specify it as the installation path of jdk

python: check add environment variable during installation (the installation is automatically added to the path of user variable)

How to check the successful installation:
1.cmd call: the instructions are gdb g++ java --version python --version

​ 2. Open the environment variable and check it one by one according to the above matching path

5. Open vs code and add plug-ins of various programming languages

Each of the following plug-in functions will not be listed (in short, this is to pave the way for upgrading to a compiler on the port of text editor)

All plug-ins recommended by the system must be installed

C/C++: C/C++

java: Java Extension Pack (including the following six expansion packs)

​ Language Support for Java(TM) by Red Hatredhat

​ Debugger for Java

​ Java Test Runner

​ Maven for Java

​ Project Manager for Java

​ Visual Studio IntelliCode

python: python

You are prompted to install the following pylance

​ jupyter

6. Configure in vs code to connect with the established environment variables

The essence of vs code running is to execute commands through environment variables through powershell (system command window)

Method 2 is faster

Method 1: the configuration function of json is more reflected here

C: default match

Add path: java - open extension - home option

Python: open Settings - Extension - Python, find the python path, and add the path

Method 2: establish the first program to debug, and the relevant kernel in the environment variable will be detected automatically

C/C + +: default matching after running Description: the generated launch tasks(gdk g + +) are configurations related to debugging. If debugging is not required, they can be deleted

java: select java home matching after running

python: select the interpreter version after running (or call the Command Panel > python select interpreter)

Summary: in fact, each language plug-in installed in vs code can quickly detect the value in the environment variable, so you can quickly select the relevant ecosystem used after trying to run a language (such as the bin folder of mingw in C, the jdk folder in java home in java, and python.exe in Python). The above operations are the embodiment of json configuration file

One more point: the two files related to C debugging mentioned above can be set and matched during detection, or can be transplanted directly with the configured files.

7. configuration has completed the start procedure

c/python slightly open the Command Panel > create java project

The reason why I don't choose shortcut keys: the hotkeys of different computer software are easy to conflict and too many are not easy to remember

8. Add several other commonly used plug-ins

1. Theme plug-in

community material theme

2. Transparency plug-in

windows opacity

3.md writing plug-in

markdown all in one markdown preview enhanced

4.html code preview plug-in

browser preview

open in browser

5. Screenshot plug-in

code snap

6. Quickly generate annotation plug-ins


7. Code formatting


Right click to select quick format to change its own format in the settings. The relevant options are not universal to all code types

8.leetcode plug-in

Note that the plug-in depends on node JS environment

Debug leetcode


Leetcode Debugger for C++

Leetcode Extension Pack

9.compareit plug-in

Realize the comparison and differentiation of file contents

10. Spell check

code spell checker

11. Background cover plug-in

You can achieve the effect of custom background

Then install the following plug-ins (unsupported words will appear when modifying CSS) for formal repair

Fix VSCode Checksums

On the command panel, enter Fix Checksums: Apply

One more point: for the problem of terminal input, by default, powershell (system command) is embedded and displayed in the terminal by default

Pay attention to using clear to clear the screen and solve the problem. Pay attention to using the up key to input again

The following command can clear some windows information

"terminal.integrated.automationShell.windows": "",
"terminal.integrated.shellArgs.windows": ["-NoLogo"],

VS code json


This article is aimed at the exquisite configuration source file after the plug-in has been installed (replacing each setting with json code)

Above description:

1. The default configuration is not reflected in the user json file. The system comes with it

User profile is the supplement and coverage of system profile

2. Location of configuration file: C:\Users\username\AppData\Roaming\Code\User

Location of plug-in: C: \ users \ username \ vscode

3. New Placing json files in vscode plays the role of local space configuration for code files with this as the root directory

Fully annotated version (do not copy directly)

    "editor.suggestSelection": "first", //Set all setting options. The first option is selected by default
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", //This item represents all artificial modifications and overrides the default value
    "workbench.colorTheme": "Community Material Theme Darker High Contrast", //Set background theme
    "editor.fontFamily": "JetBrains Mono", //Set font
    "editor.fontLigatures": true, //Conjoined character
    "editor.fontSize": 14, //Set font size
    "editor.smoothScrolling": false, // Roll smooth off
    "terminal.integrated.fontFamily": "JetBrains Mono", //Control the font displayed on the terminal
    "workbench.sideBar.location": "right", //Set Explorer on the right
    "editor.acceptSuggestionOnEnter": "off", //When you press enter, it is a line feed. Only tab will accept Intellisense to avoid the intelligent perception of entering
    "window.title": "${dirty}${activeEditorLong}${separator}${rootName}${separator}${appName}", //Set the header line at the top when the file is displayed
    "files.trimTrailingWhitespace": true, // When saving, delete the space at the end of each line
    "files.insertFinalNewline": true, // After saving, add a whole blank line at the end of the file, refer to Linux
    "editor.wordSeparators": "`~!@#$%^&*()-=+[{]}\|;:'\ ",.<>/?·~!¥…()—[],;: ‘’“”,. <>? ", // You can ctrl+backspce to delete the following symbols
    "workbench.iconTheme": "material-icon-theme", //Set folder theme
    "files.autoGuessEncoding": true, // When enabled, attempts to guess the character set encoding when the file is opened
    "editor.snippetSuggestions": "inline", //Code snippets are displayed along with other suggestions
    "editor.dragAndDrop": true, // After selecting the text, you can drag to adjust the position
    "editor.cursorSmoothCaretAnimation": true, // Becomes smooth as you move the cursor
    "editor.suggest.snippetsPreventQuickSuggestions": true, //Intelligently trigger the jump point of snappets of Cland (jump function)
    "editor.minimap.enabled": true, //Open code thumbnail
    "window.zoomLevel": 0, // Overall amplification
    "workbench.settings.useSplitJSON": false, //How to render the json of the configuration file (whether to column or not)
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    }, //Configure settings for folders
    "git.enabled": true,
    "git.ignoreMissingGitWarning": true, //git upload configuration
    "python.languageServer": "Pylance", //Language Support Plug-Ins associated with python
    "python.pythonPath": "D:\\vs code\\python\\python.exe", //Configure the environment variable path indicated by python
    "java.home": "D:\\vs code\\java", //Configure the environment variable path indicated by java
    "code-runner.runInTerminal": true,
    "code-runner.clearPreviousOutput": true, //Set the input configuration of the code runner plug-in on the terminal
    "open-in-browser.default": "Microsoft Edge", //Set the browser used to preview html code
    "browser-preview.startUrl": "https://www.cnblogs.com/wqcstudy ", / / set the default URL to open html preview (embedded)
    "browser-preview.chromeExecutable": "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge", //Control the relevant browser for previewing html code (embedded)
    "winopacity.opacity": 255,
    "codesnap.target": "window", //Set the application of transparency plug-in
    "fileheader.cursorMode": {
        "description": "",
        "param": "",
        "return": ""
    }, //Set function header description
    "fileheader.customMade": {
        "author": "wqc",
        "description": "",
        "Date": "Do not edit"
    }, //Set file header description
    "leetcode.endpoint": "leetcode-cn",
    "leetcode.workspaceFolder": "C:\\Users\\86158\\Desktop\\code-cpp\\leetcode",
    "leetcode.defaultLanguage": "cpp",
    "leetcode.hint.configWebviewMarkdown": false, //About the configuration of leetcode related plug-ins
    "editor.tokenColorCustomizations": {
        "comments": "#82e0aa ", / / comment color
        "settings": {
            "fontStyle": " ", //Uncomment italics may be in conflict with the plug-in, which is not successful temporarily
    "editor.wordWrapColumn": 130,
    "editor.wordWrap": "wordWrapColumn", //Controls the number of words per line when wrapping
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "editor.formatOnPaste": true, //Automatic formatting of control code
    "emmet.triggerExpansionOnTab": true, //The built-in emmet plug-in opens tab to expand abbreviation settings
     "workbench.startupEditor": "newUntitledFile",//Open the editor again and open another window
    "[javascript]": {
        "editor.defaultFormatter": "HookyQR.beautify"//Choose to use the plugin beauty for code formatting
    "[html]": {
      "editor.defaultFormatter": "HookyQR.beautify"
    "files.autoSave": "afterDelay"//Automatically save content after exiting a file

A copy of the above version

    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "workbench.colorTheme": "Community Material Theme Darker High Contrast",
    "editor.fontFamily": "JetBrains Mono",
    "editor.fontLigatures": true,
    "editor.fontSize": 14,
    "editor.smoothScrolling": false,
    "terminal.integrated.fontFamily": "JetBrains Mono",
    "workbench.sideBar.location": "right",
    "editor.acceptSuggestionOnEnter": "off",
    "window.title": "${dirty}${activeEditorLong}${separator}${rootName}${separator}${appName}",
    "files.trimTrailingWhitespace": true, 
    "files.insertFinalNewline": true,
    "editor.wordSeparators": "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?·~!¥...()—[],;: ''"",. <>? ",
    "workbench.iconTheme": "material-icon-theme",
    "files.autoGuessEncoding": true,
    "editor.snippetSuggestions": "inline",
    "editor.dragAndDrop": true,
    "editor.cursorSmoothCaretAnimation": true,
    "editor.suggest.snippetsPreventQuickSuggestions": true, 
    "editor.minimap.enabled": true, 
    "window.zoomLevel": 0, 
    "workbench.settings.useSplitJSON": false,
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    "git.enabled": true,
    "git.ignoreMissingGitWarning": true, 
    "python.languageServer": "Pylance", 
    "python.pythonPath": "D:\\vs code\\python\\python.exe", 
    "java.home": "D:\\vs code\\java", 
    "code-runner.runInTerminal": true,
    "code-runner.clearPreviousOutput": true,
    "open-in-browser.default": "Microsoft Edge",
    "browser-preview.startUrl": "https://www.cnblogs.com/wqcstudy",
    "browser-preview.chromeExecutable": "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge", 
    "winopacity.opacity": 255,
    "codesnap.target": "window",
    "fileheader.cursorMode": {
        "description": "",
        "param": "",
        "return": ""
    "fileheader.customMade": {
        "author": "wqc",
        "description": "",
        "Date": "Do not edit"
    "leetcode.endpoint": "leetcode-cn",
    "leetcode.workspaceFolder": "C:\\Users\\86158\\Desktop\\code-cpp\\leetcode",
    "leetcode.defaultLanguage": "cpp",
    "leetcode.hint.configWebviewMarkdown": false,
    "editor.tokenColorCustomizations": {
        "comments": "#82e0aa",
        "settings": {
            "fontStyle": " "
    "editor.wordWrapColumn": 130,
    "editor.wordWrap": "wordWrapColumn",
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "editor.formatOnPaste": true, 
    "emmet.triggerExpansionOnTab": true,
     "workbench.startupEditor": "newUntitledFile",
    "[javascript]": {
        "editor.defaultFormatter": "HookyQR.beautify"
    "[html]": {
      "editor.defaultFormatter": "HookyQR.beautify"
    "files.autoSave": "afterDelay"

Local space configuration of CPP

Create settings in a folder that are only suitable for cpp and only take effect for files in the current root directory json

        "C_Cpp.clang_format_sortIncludes": true, 
        "C_Cpp.autocomplete": "Default", 
        "C_Cpp.suggestSnippets": true,
        "[c]": {
            "files.encoding": "utf8" 
        "[c++]": {
            "files.encoding": "utf8" 
        "files.associations": {
            "iostream": "cpp",
            "algorithm": "cpp",
            "*.tcc": "cpp",
            "random": "cpp",
            "fstream": "cpp",
            "istream": "cpp",
            "ostream": "cpp",
            "regex": "cpp",
            "utility": "cpp",
            "array": "cpp",
            "atomic": "cpp",
            "bitset": "cpp",
            "cctype": "cpp",
            "cfenv": "cpp",
            "charconv": "cpp",
            "chrono": "cpp",
            "cinttypes": "cpp",
            "clocale": "cpp",
            "cmath": "cpp",
            "codecvt": "cpp",
            "complex": "cpp",
            "condition_variable": "cpp",
            "csetjmp": "cpp",
            "csignal": "cpp",
            "cstdarg": "cpp",
            "cstddef": "cpp",
            "cstdint": "cpp",
            "cstdio": "cpp",
            "cstdlib": "cpp",
            "cstring": "cpp",
            "ctime": "cpp",
            "cuchar": "cpp",
            "cwchar": "cpp",
            "cwctype": "cpp",
            "deque": "cpp",
            "forward_list": "cpp",
            "list": "cpp",
            "unordered_map": "cpp",
            "unordered_set": "cpp",
            "vector": "cpp",
            "exception": "cpp",
            "functional": "cpp",
            "iterator": "cpp",
            "map": "cpp",
            "memory": "cpp",
            "memory_resource": "cpp",
            "numeric": "cpp",
            "optional": "cpp",
            "ratio": "cpp",
            "set": "cpp",
            "string": "cpp",
            "string_view": "cpp",
            "system_error": "cpp",
            "tuple": "cpp",
            "type_traits": "cpp",
            "future": "cpp",
            "initializer_list": "cpp",
            "iomanip": "cpp",
            "iosfwd": "cpp",
            "limits": "cpp",
            "mutex": "cpp",
            "new": "cpp",
            "scoped_allocator": "cpp",
            "shared_mutex": "cpp",
            "sstream": "cpp",
            "stdexcept": "cpp",
            "streambuf": "cpp",
            "thread": "cpp",
            "typeindex": "cpp",
            "typeinfo": "cpp",
            "valarray": "cpp",
            "queue": "cpp"
        "C_Cpp.errorSquiggles": "Enabled"

Optimize the startup configuration of C

During java configuration, the java home environment variable can be directly matched (directly connected with the system settings) (basically no manual operation)

When configuring python, you need to select the interpreter of the corresponding version (select a version within the scope of Python) (environment variables are automatically added during Python installation)

The configuration of C can be matched to gdk and g + + without specifying environment variables to a certain extent, but the system generally generates configuration files (referring to the next one, not the above one) to complete binding (that is, in fact, the configuration files generated by the system can also be deleted), but many functions are inconvenient in program operation (therefore, C requires to complete binding configuration for convenience).

It is recommended to implement according to the system recommendations. The following two files need to be placed in the same directory of the code, and the folder name is vscode (Level 1)


// https://github.com/Microsoft/vscode-cpptools/blob/master/launch.md
    "version": "0.2.0",
    "configurations": [{
        "name": "(gdb) Launch", // The configuration name will be displayed in the drop-down menu of startup configuration
        "type": "cppdbg", // Configuration type: cppdbg corresponds to the debugging function provided by cpptools; It can be considered that this can only be cppdbg
        "request": "launch", // Request configuration type, which can be launch or attach
        "program": "${fileDirname}/${fileBasenameNoExtension}.exe", // The path of the program to be debugged
        "args": [], // The command line parameters passed to the program during program debugging are generally set to null
        "stopAtEntry": false, // When set to true, the program will pause at the program entrance, which is equivalent to breaking the point on main
        "cwd": "${workspaceFolder}", // The working directory when debugging the program, which is the workspace folder; Change ${fileDirname} to the directory where the file is located
        "environment": [], // environment variable
        "externalConsole": false, // When true, use a separate cmd window, which is consistent with other ides; Set to false after October 18 to call VSC built-in terminal
        "internalConsoleOptions": "neverOpen", // If it is not set to neverOpen, you will jump to the "debugging console" tab during debugging. You don't need to manually input commands to gdb, do you?
        "MIMode": "gdb", // Specifies the debugger to connect to, which can be gdb or lldb. But I haven't tried lldb
        "miDebuggerPath": "gdb.exe", // Debugger path. The suffix cannot be omitted under Windows, but not under Linux
        "setupCommands": [
            { // The template comes with it. It seems that it can better display the contents of STL container. The specific function is self-contained
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": false
        "preLaunchTask": "Compile" // The task executed before the start of a debugging session is generally a compiler. With tasks JSON corresponds to the label


// https://code.visualstudio.com/docs/editor/tasks
    "version": "2.0.0",
    "tasks": [{
        "label": "Compile", // Task name, same as launch JSON corresponds to the preLaunchTask
        "command": "g++",   // To use the compiler, C + + uses g++
        "args": [
            "-o",    // Specify the output file name. Without this parameter, a.exe will be output by default, and a.out will be output by default under Linux
            "-g",    // Build and debug related information
            "-Wall", // Turn on additional warning
            "-static-libgcc",     // Static link libgcc is usually added
            "-fexec-charset=utf-8", // The generated program uses GBK coding. If this item is not added, Chinese garbled code will be output under Win
            // "- STD = C11", / / the latest standard of C + + is c++17, or modify it according to your own needs
        ], // The compiled command is actually equivalent to VSC helping you input these things in the terminal
        "type": "process", // process is that vsc directly passes all the predefined variables and escape parsing to command; The shell is equivalent to opening the shell first and then entering the command, so args will be parsed again through the shell
        "group": {
            "kind": "build",
            "isDefault": true // If it is not true, ctrl shift B will be selected manually
        "presentation": {
            "echo": true,
            "reveal": "always", // Whether to jump to the terminal panel during task execution can be always, silent, never. See VSC documentation for details
            "focus": false,     // When set to true, the focus of task execution can be focused on the terminal, but for compiling C/C + +, setting to true makes no sense
            "panel": "shared"   // The compilation information of different files shares a terminal panel
        "problemMatcher":"$gcc" // This option can capture the error information in the terminal during compilation; However, due to Lint, there may be double error reporting when opening this again

Posted by mithril on Sun, 17 Apr 2022 14:50:15 +0930