Home >Development Tools >VSCode >How vscode organizes code

How vscode organizes code

尚
Original
2020-01-09 14:18:0425139browse

How vscode organizes code

How to organize the code in vscode:

1. Use the code formatting function of vscode to organize it. The shortcut keys for formatting the code in vscode are as follows:

Use shortcut keys in Windows environment: Shift Alt F

Use shortcut keys in Mac environment: Shift Option F

Use shortcut keys in Ubuntu environment: Ctrl Shift I

2. Use plug-in to format code:

Example:

Requires plug-in: eslint

How vscode organizes codeAdd in settings:

"eslint.autoFixOnSave": true,
"eslint.validate": [
  "javascript",
  "javascriptreact",
  {
    "language": "html",
    "autoFix": true
  },
  {
    "language": "vue",
    "autoFix": true
  }
],

eslint.autoFixOnSave is used to automatically format when saving, but only supports javascript .js files by default.

eslint.validate is used to configure the file type used.

Then when you save the code, it will be automatically formatted into eslint style (it needs to be saved multiple times).

Recommended related articles and tutorials: vscode tutorial

The above is the detailed content of How vscode organizes code. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn