search
HomeDevelopment ToolsVSCode13 VSCode usage tips worth knowing to improve your development efficiency

This article will share with you 13 VSCode usage tips to enable efficient development mode. I hope it will be helpful to everyone!

13 VSCode usage tips worth knowing to improve your development efficiency

VsCode is an open source editor with powerful functions. Due to the various plug-ins, VsCode can do more things. There are many skills in the process of using it. Mastering some skills will make it much easier to write code later. [Recommended learning: "vscode tutorial"]

1. View the log

Step 1. Execute Ctrl Shift P

Step 2. Search showlogs

2. Open the VSCode configuration file settings.json

Step 1. Execute Ctrl Shift P

Step 2. Search Open Settings (JSON)

3. View the log when connecting to the remote end

Add the following parameters in the VSCode configuration file settings.json

"remote.SSH.showLoginTerminal": true,

4. VSCode background configuration For Bean Paste Green

Add the following parameters to the VSCode configuration filesettings.json

"workbench.colorTheme": "Atom One Light",
"workbench.colorCustomizations": {
   "[Atom One Light]": {
      "editor.background": "#C7EDCC",
      "sideBar.background": "#e7f0e7",
      "activityBar.background": "#C7EDCC",
    },
},

5. Set the remote default installed plug-in

in Add the remote.SSH.defaultExtensions parameter to the VSCode configuration file settings.json, such as automatically installing the Python and Maven plug-ins, which can be configured as follows.

"remote.SSH.defaultExtensions": [
   "ms-python.python",
   "vscjava.vscode-maven"
 ],

6. Install the local specified plug-in to the remote or install the remote plug-in to the local

Step 1. Execute Ctrl Shift P

Step 2. Search for install local, select as needed

7. Use Git repository remotely

7.1 Local Host configuration, this article takes Windows 10 system as an example

Step 1. Install OpenSSH

Step 2. Start PowerShell as administrator and execute the following commands as needed:

  • Start SSHD service:

    Get-WindowsCapability -Online | ? Name -like 'OpenSSH*' Start-Service sshd Set-Service -Name sshd -StartupType 'Automatic' Get-NetFirewallRule -Name sshNew-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

  • Allow Windows to automatically run SSH Agent:

    Set-Service ssh-agent -StartupType Automatic Start-Service ssh-agent Get-Service ssh-agent

  • Add the private key pair to the running agent:

    ssh-add.exe .\id_rsa #The path is the private key to be added key location ssh-add.exe -L

Step 3. Edit the local sshconfig (such as ~\.ssh\config) file and add the configuration ForwardAgentyes, as shown below .

Host my_host
    HostName x.x.x.x
    Port x
    User x
    IdentityFile xx
    ForwardAgent yes

If you add ForwardAgentyes to all Hosts by default, you can add the following configuration:

Host *
   ForwardAgent yes

7.2 Flexible remote use of Git repositories

Brief For Git operation guidance videos, please refer to the VSCode video tutorial (3 minutes and 54 seconds):

code.visualstudio.com/docs/introv…

More details on how to use Git functions You can read the official VSCode documentationcode.visualstudio.com/docs/editor…

8. Install the plug-in remotely based on the offline package

Step 1. Go to the VSCode plug-in official website vscode_marketplace searches for the A plug-in to be installed

Step 2. Click to enter the details of the A plug-in and download the offline installation package of the plug-in. As shown in the figure:

13 VSCode usage tips worth knowing to improve your development efficiency

Step 3. Drag the downloaded .vsix file to the remote container

Step 4. Right-click the file , select Install ExtensionVSIX

9. After the remote restart, you need to delete the local known_hosts to connect

You can configure the parameters "StrictHostKeyChecking no" and "UserKnownHostsFile=/ for this container in the local sshconfig file dev/null", as shown in the following reference:

Host my_host
    HostName x.x.x.x
    Port x
    User x
    IdentityFile xx
    ForwardAgent yes
    StrictHostKeyChecking no
    UserKnownHostsFile=/dev/null

Tip: Adding the above configuration parameters will ignore the known_hosts file during SSH login, which is a security risk.

10. The source code cannot be entered during code debugging

If you already have the launch.json file, please go directly to step 3. Step 1: Open the launch.json file. Can be opened in any of the following ways:

  • 方法一:点击左侧菜单栏的Run(Ctrl+Shift+D)按钮,再点击create a launch.json file。如下图所示:

13 VSCode usage tips worth knowing to improve your development efficiency

  • 方法二:点击上侧菜单栏中的Run > Open configurations按钮

步骤2:选择语言

如果需要对Python语言进行设置,在弹出的Select a debug configuration中选择Python File,其他语言操作类似。如下图所示:

13 VSCode usage tips worth knowing to improve your development efficiency

步骤3:编辑launch.json,增加justMyCode":false配置,如下图所示:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: 当前文件",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false
        }
    ]
}

11.提交代码时弹出对话框提示用户名和用户邮箱配置错误

13 VSCode usage tips worth knowing to improve your development efficiency

terminal中,执行如下述命令,再重试提交即可:

git config --global user.email my_email #改为你的用户邮箱
git config --global user.name my_name #改为你的用户名

12. 禁止自动升级VSCode版本

步骤1. 执行Ctrl+Shift+P

步骤2. 搜Open Settings(JSON)

步骤3. 在配置文件settings.json中添加如下参数"update.mode":"manual"

13. 禁止自动升级VSCode的插件版本

步骤1. 执行Ctrl+Shift+P

步骤2. 搜Open Settings(JSON)

步骤3. 在配置文件settings.json中添加如下参数"extensions.autoUpdate":false

更多编程相关知识,请访问:编程入门!!

The above is the detailed content of 13 VSCode usage tips worth knowing to improve your development efficiency. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:掘金社区. If there is any infringement, please contact admin@php.cn delete
Visual Studio: Exploring the Free and Paid OfferingsVisual Studio: Exploring the Free and Paid OfferingsApr 22, 2025 am 12:09 AM

The main difference between the free and paid versions of VisualStudio is the richness of features and the service supported. The free version (Community) is suitable for individual developers and small teams, providing basic development tools; the paid version (Professional and Enterprise) provides advanced features such as advanced debugging and team collaboration tools, suitable for large projects and enterprise-level development.

Visual Studio Community Edition: The Free Option ExplainedVisual Studio Community Edition: The Free Option ExplainedApr 21, 2025 am 12:09 AM

VisualStudioCommunityEdition is a free IDE suitable for individual developers, small teams and educational institutions. 1) It provides functions such as code editing, debugging, testing and version control. 2) Based on the Roslyn compiler platform, it supports multiple programming languages ​​and integrates Git and TFVC. 3) Advanced features include unit testing, optimization suggestions include turning off unnecessary extensions and using a lightweight editor.

Visual Studio: Building Applications with EaseVisual Studio: Building Applications with EaseApr 20, 2025 am 12:09 AM

VisualStudio is an integrated development environment (IDE) developed by Microsoft, which supports a variety of programming languages, including C#, C, Python, etc. 1. It provides IntelliSense function to help write code quickly. 2. The debugger allows setting breakpoints, step-by-step code execution, and identifying problems. 3. For beginners, creating a simple console application is a great way to get started. 4. Advanced usage includes the application of design patterns such as project management and dependency injection. 5. Common errors can be solved step by step through debugging tools. 6. Performance optimization and best practices include code optimization, version control, code quality inspection and automated testing.

Visual Studio and VS Code: Understanding Their Key DifferencesVisual Studio and VS Code: Understanding Their Key DifferencesApr 19, 2025 am 12:16 AM

VisualStudio is suitable for large-scale projects and enterprise-level application development, while VSCode is suitable for rapid development and multilingual support. 1. VisualStudio provides a comprehensive IDE environment and supports Microsoft technology stack. 2.VSCode is a lightweight editor that emphasizes flexibility and scalability, and supports cross-platform.

Is Visual Studio Still Free? Understanding the AvailabilityIs Visual Studio Still Free? Understanding the AvailabilityApr 18, 2025 am 12:05 AM

Yes, some versions of VisualStudio are free. Specifically, VisualStudioCommunityEdition is free for individual developers, open source projects, academic research, and small organizations. However, there are also paid versions such as VisualStudioProfessional and Enterprise, suitable for large teams and enterprises, providing additional features.

Using Visual Studio: Developing Software Across PlatformsUsing Visual Studio: Developing Software Across PlatformsApr 17, 2025 am 12:13 AM

Cross-platform development with VisualStudio is feasible, and by supporting frameworks like .NETCore and Xamarin, developers can write code at once and run on multiple operating systems. 1) Create .NETCore projects and use their cross-platform capabilities, 2) Use Xamarin for mobile application development, 3) Use asynchronous programming and code reuse to optimize performance to ensure efficient operation and maintainability of applications.

How to format json with vscodeHow to format json with vscodeApr 16, 2025 am 07:54 AM

The ways to format JSON in VS Code are: 1. Use shortcut keys (Windows/Linux: Ctrl Shift I; macOS: Cmd Shift I); 2. Go through the menu ("Edit" > "Format Document"); 3. Install JSON formatter extensions (such as Prettier); 4. Format manually (use shortcut keys to indent/extract blocks or add braces and semicolons); 5. Use external tools (such as JSONLint and JSON Formatter).

How to compile vscodeHow to compile vscodeApr 16, 2025 am 07:51 AM

Compiling code in VSCode is divided into 5 steps: Install the C extension; create the "main.cpp" file in the project folder; configure the compiler (such as MinGW); compile the code with the shortcut key ("Ctrl Shift B") or the "Build" button; run the compiled program with the shortcut key ("F5") or the "Run" button.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool