Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Why use VS Code

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces why VS Code is used. The introduction in this article is very detailed and has certain reference value. Interested friends must read it!

Why VS Code

JavaScript as a representative, in the past when we debug JS, we need to use browser F12, the code needs to use console.log or alert to output the process, used to VS compiler developers for example will not be used to. VS Code can now be used for development, it is open source free, by installing development language-related plug-ins, you can let VS Code achieve the corresponding syntax recognition and code hints, currently the expansion store has provided plug-ins for most programming languages, you can download them at will, commonly used are Script JScript, EScript , and other languages including PHP, Python, etc.

VS Code Installation

Visual Studio Code (here referred to as VS Code) download address: https://code.visualstudio.com/

About launch.json

launch.json is a configuration file automatically generated by VSCode in the current development directory. During development, according to the project type, configure the path and running environment of the program startup, as shown in the following figure, describing the file path currently to be debugged as "${workspaceFolder}/scripts/debug.js", and the program uses node for debugging.

Click on the Add Configuration button to see more options for configuration. The list of options is related to the currently installed extension, such as after Chrome is installed.

The specific meanings of some predefined variables in launch.json are as follows

Path to open folder in ${workspaceRoot} VSCode

The path of the folder opened in VS Code

Path to open folder in ${workspaceRootFolderName} VSCode, but does not contain '/'

The name of the folder opened in VS Code without any solidus (/)

${file} currently open file

The current opened file

${relativeFile} Current open file (relative to workspaceRoot)

The current opened file relative to workspaceRoot

${fileBasename} The filename of the currently open file, without extensions

The current opened file's basename

${fileDirname} Directory name of the currently open file

The current opened file's dirname

${fileExtname} Extension of the currently open file

The current opened file extension

${cwd} The working directory (startup directory) of the currently running task

The task runner's current working directory on startup

Developing Javascript with VS Code

Install Script Plugin

Developing with ECMAScript, installing ESLint

Develop with TypeScript, install TSLint

Develop with Javascript, install jshint

Debug Script

1. Debugging environment, using node compilation environment.

2. Configure launch.json

{

"type": "node",

"request": "launch",

"name": "Launch Program",

"program": "${workspaceFolder}/scripts/debug.js" ?// The js file that needs to be tested is referenced to debug.js by require, which can be used to simulate button click effects or to test algorithms.

}

3. Switch to debug page and start debugging, as shown in the figure:

How to set it to Chinese

Press Ctrl+shift+p on the keyboard, and a command box appears, as shown in the figure:

Enter configure language

Finally, in the newly opened language configuration file, modify locale: "en-us" to locale: "zh-cn" and restart. The configuration is complete, as shown in the figure:

That's all for "Why VS Code", thanks for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report