Visual Studio Code



  • vscode/Vidual Studio Code official website

    VS Code shortcut keys

    Commonly used shortcut keys

    Edit related shortcut keys

    Multiple cursors and selection

    File and window management

    Debugging and Execution

    Search and replace

    Custom shortcut keys

    You can useFile > Preferences > Keyboard Shortcuts(or pressCtrl + K + Ctrl + S) to customize the shortcut key settings.



    Shortcut key to switch from editor to file manager

    Use built-in shortcut keys

    After pressing this shortcut key, the focus will switch from the editor to the Explorer window.

    Custom shortcut keys

    1. according toCtrl + K Ctrl + S(Windows/Linux) orCmd + K Cmd + S(Mac) Turn on shortcut key settings.
    2. search「focus on explorer」,turn upworkbench.view.explorer
    3. Click on the item and set the shortcut key you want, for exampleCtrl + Alt + E

    Manually set `keybindings.json`

    If you want to manually modify the JSON settings, you cankeybindings.jsonAdd the following:

    [
        {
            "key": "ctrl+alt+e",
            "command": "workbench.view.explorer"
        }
    ]

    Test shortcut keys

    1. Make sure a code file is open and within the editor.
    2. pressCtrl + Shift + EOr your customized shortcut keys.
    3. The focus should switch to File Explorer on the left.


    Open settings.json of VS Code

    Method 1: Through the command panel

    1. pressCtrl + Shift + P(Mac:Cmd + Shift + P)。
    2. enterPreferences: Open Settings (JSON)and choose.
    3. VS Code will opensettings.json, you can edit personal settings directly.

    Method 2: Enter from the graphical interface

    1. Click the gear icon (⚙️) in the lower left corner.
    2. Select Settings.
    3. Click the "{} Open Settings (JSON)" icon in the upper right corner to entersettings.jsonEdit page.

    Method 3: Directly open the file location

    Windows / Linux:

    
    %APPDATA%\Code\User\settings.json
    

    macOS:

    
    ~/Library/Application Support/Code/User/settings.json
    

    You can also use VS CodeFile → Open FileOpen the file at this path directly.



    VS Code Terminal

    Opening method

    Terminal type

    Set default terminal

    {
      "terminal.integrated.defaultProfile.windows": "PowerShell",
      "terminal.integrated.profiles.windows": {
        "PowerShell": {
          "path": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
        },
        "Command Prompt": {
          "path": "C:\\Windows\\System32\\cmd.exe"
        },
        "Git Bash": {
          "path": "C:\\Program Files\\Git\\bin\\bash.exe"
        }
      }
    }
    

    Switch terminal

    Multi-terminal operation

    Debug and Terminal relationship

    FAQ



    Configure integrated terminal using cmd or PowerShell

    Modify settings.json

    Open in VS Codesettings.json, add the following settings:

    "terminal.integrated.defaultProfile.windows": "Command Prompt",
    "terminal.integrated.profiles": {
        "Command Prompt": {
            "path": "C:\\Windows\\System32\\cmd.exe"
        },
        "PowerShell": {
            "path": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
        }
    }
    

    Effect

    Notice

    If you have Git Bash, WSL, or another shell installed, you can alsoprofilesAdd them together in the section to facilitate switching.

    Case: Use cmd when setting up debugging in VS Code, but the default terminal is still PowerShell

    practice

    The terminal used for "Execution and Debugging" of VS Code can be used throughlaunch.jsoninconsoleandinternalConsoleOptionsto control.

    Example settings

    Keep PowerShell as the default integrated terminal

    "terminal.integrated.defaultProfile.windows": "PowerShell",
    "terminal.integrated.profiles": {
        "PowerShell": {
            "path": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
        },
        "Command Prompt": {
            "path": "C:\\Windows\\System32\\cmd.exe"
        }
    }
    

    Specify Debug in launch.json using cmd

    {
      "version": "0.2.0",
      "configurations": [
        {
          "name": "Launch Python program (using cmd)",
          "type": "python",
          "request": "launch",
          "program": "${file}",
          "console": "integratedTerminal",
          "internalConsoleOptions": "neverOpen",
          "windows": {
            "command": "cmd.exe"
          }
        }
      ]
    }

    Effect



    Syntax formatting in VS Code

    1. Use shortcut keys for formatting

    Visual Studio Code provides shortcut keys to quickly format code: - **Format entire file**: Press `Shift + Alt + F` (Windows) or `Shift + Option + F` (Mac). - **Format selected area**: Press the above shortcut key after selecting the code.

    2. Enable automatic formatting when saving files

    Visual Studio Code supports automatic code formatting: 1. Open **File > Preferences > Settings**. 2. Search for **format on save**. 3. Check **Editor: Format On Save** and the file will be automatically formatted when saving.

    3. Install format extension tools

    1. Open the **Extension Market**, search and install the appropriate formatting tool, for example: - **Prettier - Code formatter**: for JavaScript, TypeScript, HTML, CSS, and more. - **Black**: for Python. 2. After installation, VS Code will automatically use extension tools for formatting.

    4. Set the default formatting tool

    If multiple formatting extension tools are installed, you can set the default formatting tool: 1. Open **File > Preferences > Settings**. 2. Search for **default formatter**. 3. Select the tool you want to use in **Editor: Default Formatter**.

    5. Custom formatting rules

    Some formatting tools support custom rules. Here is Prettier as an example: 1. Create a `.prettierrc` file in the project directory. 2. Add custom rules, for example:
       {
           "tabWidth": 4,
           "useTabs": false,
           "singleQuote": true,
           "trailingComma": "es5"
       }
       

    6. Use the .editorconfig file

    `.editorconfig` is used to unify the team’s coding style: 1. Create an `.editorconfig` file in the project root directory. 2. Add rules, for example:
       [*.{js,css,html}]
       indent_style = space
       indent_size = 2
       

    7. Quickly fix format problems

    When formatting issues arise, use quick fixes: 1. Right-click on the problem code and select **Format File** or **Format Selection**. 2. Use shortcut keys to perform quick fixes.

    8. Summary

    - Use shortcut keys to quickly format code. - Enable automatic formatting to improve efficiency. - Install extensions to support more languages. - Use `.editorconfig` and tool-specific configuration files to unify the format.

    VS Code changes file encoding

    Use shortcut keys to change file encoding

    1. according toCtrl + K Ctrl + S(Windows/Linux) orCmd + K Cmd + S(Mac) Turn on shortcut key settings.
    2. Click the "Open JSON" icon in the upper right corner to openkeybindings.json
    3. Add the following settings to set the shortcut key to change the file encoding to UTF-8:
    [
        {
            "key": "ctrl+alt+u",
            "command": "workbench.action.editor.changeEncoding",
            "args": "utf8",
            "when": "editorTextFocus"
        }
    ]

    Manually change the encoding through the command panel

    1. according toCtrl + Shift + P(For MacCmd + Shift + P)。
    2. search「Change File Encoding」(Change file encoding).
    3. Select the target encoding, e.g.UTF-8orBig5

    Common encoding list

    Test shortcut keys

    1. Open a non-UTF-8 encoded archive (such as Big5).
    2. pressCtrl + Alt + U(or the shortcut key you set).
    3. The archive should be converted to UTF-8 immediately (no manual selection required).


    Convert archive from Big5 encoding to UTF-8

  • Step 1: Open the Big5 encoded file in VS Code Open Visual Studio Code. Use "File" -> "Open File" to open a file encoded in Big5.
  • Step 2: Set file encoding to Big5 In the lower right corner of VS Code, click the encoding indicator (for example, the default might say UTF-8). In the drop-down list that appears, select "Reopen with code." From the encoding list, select Big5. This tells VS Code to interpret the file as Big5 encoding.
  • Step 3: Convert encoding to UTF-8 Once the file opens and displays correctly as Big5, click the encoding indicator again. Now, choose to save using encoding. Select UTF-8 from the list.
  • Step 4: Save the file After selecting UTF-8, Visual Studio Code will convert the file's encoding to UTF-8 and save it. You can now confirm whether the file is UTF-8 by checking the encoding indicator again.

    Align Chinese fonts in Unicode fields

    Requirements description

    In VS Code, if you edit files containing Chinese characters, full-width symbols, or Unicode special characters, you will often encounter problems with inconsistent character widths and inability to vertically align. These issues can still occur even when using fixed-width English fonts, especially when CJK characters are involved.

    Recommended Chinese fonts

    The following fonts can better handle the problem of Chinese equal-width arrangement:

    Setting method

    turn onsettings.json(shortcut keyCtrl + Shift + P→ Enter "Preferences: Open Settings (JSON)") and add the following settings:

    "editor.fontFamily": "'SimSun-ExtB', 'MS Gothic', 'imitate Song Dynasty', 'standard script', monospace"

    This setting will try to load fonts in sequence, falling back to the next one if the former is not installed.

    Suggested additional settings

    Things to note

    in conclusion

    If you want to use Traditional Chinese fonts in VS Code to achieve neat alignment of Unicode fields, you can useSimSun-ExtBMS GothicImitation of Song Dynastystandard italic styleWait for combination settings, and enable auxiliary settings to enhance the alignment effect.



    Convert all spaces to Tabs in VS Code

    1. Open the command panel

    - Press `Ctrl + Shift + P` (`Cmd + Shift + P` for macOS) to open the command panel. - Enter **"Convert Indentation to Tabs"** and select it.

    2. Confirm the current indentation type

    - Check the status bar in the lower right corner to check the indentation type of the current file (e.g. `Spaces: 4`). - Click this area to open the indentation settings menu.

    3. Convert indentation to Tab

    - Select **"Convert Indentation to Tabs"** in the menu, this will replace all spaces used for indentation with Tabs.

    4. Adjust Tab width (optional)

    - Click the indentation setting in the lower right corner again (e.g. `Tab Size: 4`). - Set the Tab width you want (e.g. `4`).

    5. Save file

    - After the conversion is complete, press `Ctrl + S` (use `Cmd + S` on macOS) to save the file.

    6. Set the default indentation to Tab (optional)

    If you want all files to use Tab by default, follow these steps:

    Step 1: Open settings

    - Press `Ctrl + ,` (macOS uses `Cmd + ,`) to open the settings menu.

    Step 2: Search indentation settings

    - Search for **"Editor: Insert Spaces"**. - Uncheck this option to use Tab instead.

    Step 3: Set Tab Width

    - Search for **"Editor: Tab Size"**. - Set your desired Tab width (e.g. `4`).

    Step 4: Apply to workspace (optional)

    - If you only want these settings to apply to the current workspace, open the **Workspace Settings** tab to make adjustments.

    Summarize

    By following the above steps, you can easily convert all spaces to Tabs in Visual Studio Code and make default settings as per your requirement.

    VS Code switches the folded display of the program code

    Manually toggle folding

    Set folding on or off

    1. Open settings (Ctrl + , or Cmd + ,).
    2. searchEditor > Folding
    3. switchEditor: Foldingsettings:
      • On (default):Collapse ranges are allowed.
      • closure:Disable folding.

    or edit directlysettings.json

    {
        "editor.folding": false
    }

    specific block folding

    Extended functions



    VS Code uses the file name at the cursor position to perform Go To File

    Method 1: UseCtrl + Pand copy the current word

    1. Place the cursor on the file name.
    2. according toCtrl + Shift + ←(Mac: Cmd + Shift + ←) to select a file name.
    3. according toCtrl + C(Mac: Cmd + C) to copy the file name.
    4. according toCtrl + P(Mac: Cmd + P) onGo To Filepanel.
    5. Paste the file name (Ctrl + VorCmd + V) and pressEnterOpen the file.

    Method 2: Useeditor.action.goToImplementation

    Method 3: Use an expansion kitQuick File Open

    If you often need this function, you can installQuick File OpenExtension package and set shortcut keys to automatically extract the file name from the cursor position and open it.

    3.1: Expansion KitOpen file - Frank Stuetzer

    3.2: Expansion KitOpen file From Path - jack89ita



    VS Code calculates the sum of the column selection area

    Basic instructions

    Although VS Code supports column selection (Column Selection), itNo built-in functionality by defaultThe values ​​in the selected area can be summed directly. However, you can achieve this goal through the following methods.

    Method 1: Use expansion kit

    Method 2: Copy to the built-in terminal for calculation

    1. After selecting the value in the column, pressCtrl+Cclone
    2. Paste into VS Code's terminal (or any shell that supports computing, such as the Python REPL)
    3. Execute code, for example:
    # Python example
    nums = [12, 15, 8, 10]
    print(sum(nums))

    Method 3: Manually insert and export using multiple cursors

    The values ​​can be quickly sorted and pasted into tools such as Excel, Google Sheets, or Pandas for summing.

    suggestion

    If you often need to perform this kind of operation, installCalculateExpansion kits are the most convenient and straightforward approach.



    VS Code sorts selected rows

    Function description

    Visual Studio Code supports sorting multi-line text in a selected area by alphabetical order, numerical order, or reverse order. It is often used for code organization, data processing, or list organization.

    Usage

    Use built-in commands

    1. Select the multi-line text you want to sort
    2. Open the command menu:Ctrl + Shift + P
    3. enterSort Lines Ascending(raised to a raised power) orSort Lines Descending(lowering power)
    4. Press Enter and the selected rows will be sorted immediately

    shortcut key

    There are no shortcut keys bound by default, you can set them yourself:

    1. Go toFile → Preferences → Keyboard Shortcuts
    2. searchSort Lines AscendingorDescending
    3. Click the pencil icon to set a custom shortcut key

    Advanced sorting (needs expanded functionality)

    If you need to customize the sorting conditions (for example: ignore case, sort by fields, sort by natural numbers, etc.), you can install the following extensions:

    Supplementary skills

    in conclusion

    VS Code has built-in support for basic row sorting functions. If you have advanced needs, you can expand the usage scenarios through expansion kits.



    VS Code insert date string

    Method 1: Use an expansion kitInsert Date String

    1. Open the Extension Marketplace (pressCtrl + Shift + X,Mac:Cmd + Shift + X)。
    2. Search and installInsert Date StringExpansion Kit. Note that there are several similar packages in the market, each supporting different parameters.
    3. After installation, shortcut keys are available by defaultAlt + Shift + IInsert the current date and time.
    4. You can also pressCtrl + Shift + P,implementInsert Date Stringinstruction.

    Method 2: Use Code Snippets

    1. according toCtrl + Shift + P(Mac:Cmd + Shift + P), enter and selectPreferences: Configure User Snippets
    2. Select a language (e.g.plaintext.jsonorpython.json)。
    3. Added the following sample snippet:
    "Insert Date": {
        "prefix": "date",
        "body": [
            "${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}"
        ],
        "description": "Insert current date"
    }

    enterdateand pressTabThe date can be inserted.

    Method 3: Use an expansion kitmacrosWith date function

    Supplement: Custom format

    Insert Date StringThe extension package supports multiple date formats and can be installed insettings.jsonCustom format in, for example:

    
    "insertDateString.format": "YYYY-MM-DD HH:mm:ss"
    


    Python extension for VS Code

    How to install

    1. Open VS Code and pressCtrl + Shift + X(Mac: Cmd + Shift + X) to open the "Extensions".
    2. Enter in the search barPython,chooseOfficial Python extensions from Microsoft(Blue icon).
    3. ClickInstallInstall.

    Main functions

    Syntax Highlighting and IntelliSense

    Outline View functions and categories

    Debugging

    Python environment management

    Jupyter Notebook support

    Recommended Python related extensions

    Extension package name Function description
    Python (Microsoft) Official Python support, including syntax highlighting, completion, and debugging
    Pylance Provides faster IntelliSense and type checking
    Jupyter Let VS Code support Jupyter Notebook
    Python Environment Manager Conveniently manage Python virtual environments
    Python Docstring Generator Automatically generate Python annotations (Docstring)


    Browse the function list of the current Python file in VS Code

    Using the Outline panel

    1. Open the sidebar (Explorer) of VS Code.
    2. turn upOutlineThe panel will automatically display the functions and categories of the current Python file.
    3. If it is not displayed, you can pressCtrl + Shift + P(Mac: Cmd + Shift + P) Open the command panel and enterView: Show Outlineand execute.

    Use quick symbol search

    1. according toCtrl + Shift + O(Mac: Cmd + Shift + O)。
    2. A list of all functions and categories of the current file will be displayed, and you can click to jump quickly.

    use@or:Quick filter

    Using Python extensions



    VS Code switches Conda environment

    1. Open the interpreter selector

    There are two main ways to open the environment selection menu in the VS Code interface:

    2. Select the specified environment

    Once the menu opens, look for your environment in the list:

    3. Configure the terminal to automatically activate

    In order to ensure that the program can be used correctly when executing the program in the terminal inside VS Codetf_env, please check the following settings:

    4. Verify the current execution environment

    Add the following snippet to your code and check whether the output path is correctly pointed after executiontf_env, to ensure the DLL loading path is correct:

    importsys
    import os
    
    # Check Python executable file path
    print("Current Python:", sys.executable)
    
    # Check the DLL search path (for troubleshooting TensorFlow errors)
    if hasattr(os, 'add_dll_directory'):
        print("DLL Directories:", os.environ.get('PATH', '').split(';')[0])

    5. Troubleshoot the problem that the environment is not displayed

    If not found in the menutf_env



    Using Git in VS Code

    Initialize the Git repository

    Connect to remote repository

    Add files to version control

    Commit changes

    Push to remote repository

    Pull remote changes

    View Git logs



    Git user information settings

    Submitter's name and email

    Git needs to record the submitter's name and email when executing a commit. If the system cannot find this information, an error will occur.

    Setup command

    Please enter the following commands in sequence in the Terminal of VS Code:

    git config --global user.name "Your Name"
    git config --global user.email "[email protected]"

    Confirm settings

    To confirm whether the setting is successful, please enter:

    git config --list

    Follow-up operations

    After the settings are completed, you can directly click the Commit button on the VS Code interface again to submit successfully.



    VS Code View File Git History

    Viewing the revision history (Git History) of a single file in VS Code can mainly be achieved through built-in functions or by installing powerful extensions. This helps you track who made changes to your code, when, and what changes were made.


    1. Use the built-in Timeline

    This is the fastest method without installing any plug-ins:

    1. on the leftExplorerClick on the file.
    2. At the bottom of the left panel, find and expandTimelineblock.
    3. All Git commit records for this file will be listed here.
    4. Click on any record and VS Code will openDiff View, the left side is the previous version, and the right side is the content after this submission.

    2. Use GitLens extensions (highly recommended)

    GitLens is a must-have tool for developers, which elevates process viewing capabilities to a professional level:


    3. Use Git History extensions

    If you prefer a more intuitive graphical interface, you can installGit HistoryPlugin:

    1. After installation, on the File tab, pressRight click
    2. chooseGit: View File History
    3. This will open a new window that displays all branch merge and commit records of the file in a hierarchical chart, and supports search and filtering.

    Function comparison table

    method advantage Suitable for the situation
    Timeline (built-in) No installation required, lightweight, ready to use. Quickly review recent simple changes.
    GitLens Extremely powerful and deeply integrated with the editor. Long-term project maintenance requires precise tracking of the responsibility of each line of code.
    Git History The graphical interface is clear and easy to read the branch directions. Need to search for specific information or view complex branch merge history.

    Command line mode (terminal)

    If you are used to using the built-in terminal of VS Code, you can also enter the following command:

    git log -p <file_path>

    This will list all commits for the file and the specific code changes (patches). according toqto exit.



    VS Code uses SSH to connect to GitHub

    Authentication SSH

    If you encounter an error message when using Git clone or other Git operations in VS Code:

    [email protected]: Permission denied (publickey)

    This means that GitHub did not successfully authenticate your SSH key. During the investigation process, you may encounter the following problems:

    Step 1: Confirm SSH public key and GitHub settings

    1. Use the command to view the local SSH public key fingerprint:
      ssh-keygen -lf ~/.ssh/id_rsa.pub
    2. Log in to the GitHub website and enterSettings → SSH and GPG keys, confirm that the fingerprint is consistent with the machine

    Step 2: Confirm whether the machine has a private key

    Check directoryC:\Users\USERNAME\.ssh\, make sure there isid_rsa(private key) exists. If onlyid_rsa.pub, need to generate a new private key:

    ssh-keygen -t rsa -b 3072 -C "[email protected]"

    After generation, you will get:

    Step 3: Start SSH Agent

    1. Open services.msc → FindOpenSSH Authentication Agent→ Set to Automatic and start
    2. Close the old Terminal and reopen VS Code or the new PowerShell / CMD Terminal

    Step 4: Confirm the SSH used by VS Code Terminal

    where ssh

    Suggested results:

    C:\Windows\System32\OpenSSH\ssh.exe

    If the first one is Git Bash's ssh, please use PowerShell or CMD, or directly specify the full path to use Windows OpenSSH.

    Step 5: Modify private key permissions

    If executedssh-addAn error about excessive permissions occurs and needs to be modified:

    icacls $env:USERPROFILE\.ssh\id_rsa /inheritance:r
    icacls $env:USERPROFILE\.ssh\id_rsa /grant:r "$($env:USERNAME):(R,W)"
    icacls $env:USERPROFILE\.ssh\id_rsa

    Make sure only your own account can read and write.

    Step 6: Add the private key to the SSH agent

    ssh-add $env:USERPROFILE\.ssh\id_rsa

    Example of success message:

    Identity added: C:\Users\USERNAME\.ssh\id_rsa ([email protected])

    Step 7: Test the SSH connection

    ssh -T [email protected]

    Example of success message:

    Hi USERNAME! You've successfully authenticated, but GitHub does not provide shell access.

    Step 8: Subsequent use

    Focus on sorting out

    The entire process covers SSH public and private key management, agent startup, permission settings, and VS Code Terminal configuration. Following this operation can solve most SSH problems when using VS Code to connect to GitHub on Windows.



    PHP extension for VS Code

    Official and commonly used expansion kits

    Grammar check settings

    Available atsettings.jsonSet the PHP executable file path in:

    "php.validate.executablePath": "C:/php/php.exe"
    

    Debugging environment requirements

    1. Install PHP and enableXdebug
    2. Install the VS Code extensionPHP Debug
    3. exist.vscode/launch.jsonSet debugging parameters.

    suggestion

    If your main needs are program editing and automatic completion, installPHP IntelephenseThat’s it; if you need to debug, be sure to matchPHP Debugwith Xdebug.



    Set php.validate.executablePath and required extensions

    Necessary expansion kit

    Used in Visual Studio Codephp.validate.executablePathFunction, there is no need to install additional PHP extension packages, but you need to confirm that the PHP executable file has been installed in the system.

    It is recommended to install the following extensions to enhance your PHP development experience:

    Step 1: Install PHP

    1. toPHP official websiteDownload PHP and install
    2. Note the installation location, for example:
      • Windows: C:\\php\\php.exe
      • macOS/Linux: /usr/bin/phpor usewhich phpGet path

    Step 2: Set php.validate.executablePath

    1. turn onSettings (settings.json), which can be entered through the command menuPreferences: Open Settings (JSON)
    2. Add or modify the following content:
    "php.validate.executablePath": "C:\\php\\php.exe"

    (Linux/macOS path example:"/usr/bin/php"

    Step 3: Verify settings

    1. storesettings.json
    2. Open the PHP file. If no errors are displayed and the syntax check is normal, the setting is successful.

    Additional information



    php.ini path in VS Code

    Setting method

    VS Code itself has no direct settingsphp.inioption, it is through you insettings.jsondesignatedphp.exeto read the correspondingphp.ini. The steps are as follows:

    1. First confirm your PHP installation location, for example:
      C:\php\php.exe
      C:\php\php.ini
    2. Open in VS Codesettings.json(shortcut key:Ctrl + ,→ "Open Settings (JSON)" icon in the upper right corner).
    3. Add settings:
      "php.validate.executablePath": "C:/php/php.exe"
    4. make surephp.iniwith thatphp.exeBelongs to the same PHP installation path, so that VS Code will use it when checking syntax and debugging.php.ini

    Check the currently used php.ini

    1. Enter in the terminal:
      php --ini
    2. will display:
      Configuration File (php.ini) Path: C:\php
      Loaded Configuration File:         C:\php\php.ini

    in conclusion

    It cannot be specified directly in VS Codephp.ini, can only be specified byphp.exepath to indirectly specify whichphp.ini



    VS Code Develop Android App

    Can it be developed directly?

    Visual Studio Code itself is not a complete Android Studio replacement and lacks official Android SDK integration. However, you can develop Android App by installing extension packages and setting up the environment.

    Common ways

    Necessary environment

    suggestion

    If you want lightweight development, it is recommended to choose Flutter or React Native, and most processes can be completed in VS Code; but if you need in-depth development and debugging of native Android App, Android Studio is still the main tool.



    Execute and debug in VS Code

    Start mode

    1. Open the VS Code project folder.
    2. left clickRun and Debugicon, or use shortcut keysCtrl+Shift+D
    3. If there is no setting yet, clickCreate launch.json file

    launch.json settings

    VS Code usage.vscode/launch.jsonTo define execution and debugging methods, the following are examples in different languages:

    Node.js Example

    {
      "version": "0.2.0",
      "configurations": [
        {
          "type": "node",
          "request": "launch",
          "name": "Start Node.js program",
          "program": "${file}"
        }
      ]
    }

    PHP (with Xdebug)

    {
      "version": "0.2.0",
      "configurations": [
        {
          "name": "Listen for Xdebug",
          "type": "php",
          "request": "launch",
          "port": 9003
        }
      ]
    }
    

    Python example

    {
      "version": "0.2.0",
      "configurations": [
        {
          "name": "Start Python program",
          "type": "python",
          "request": "launch",
          "program": "${file}",
          "console": "integratedTerminal"
        }
      ]
    }

    Debugging function

    hint

    Different languages ​​need to install corresponding expansion kits, for example:



    PHP v: 7.4.10
    email: [email protected]
    
    T:0000
    資訊與搜尋 | 回dev首頁
    email: Yan Sa [email protected] Line: 阿央
    電話: 02-27566655 ,03-5924828