Preferences" in sequence; then search for format and find options related to formatting; then search for the "Beautify" plug-in in the extension store and download and install it."/> Preferences" in sequence; then search for format and find options related to formatting; then search for the "Beautify" plug-in in the extension store and download and install it.">
Home > Article > Development Tools > How to beautify code with vscode
How does vscode beautify the code?
First of all, the picture shows the effect of an open css file without line breaks. There is only one line in the entire file, and formatting has no effect.
Related recommendations: vscode introductory tutorial
Formatting refers to code that is separated into lines but is not indented and has inappropriate spacing. , becomes appropriate. VSCode comes with code formatting.
Open File->Preferences to open the settings panel.
As shown in the figure, search for format to find options related to formatting. Copy the settings you want to change to the right and modify them.
If you want to beautify the code (line wrap), first click the extension button on the left, then search for Beautify in the extension store, and then download the first plug-in.
After installation, reload VSCode, press f1 to open the command, search for Beautify, and click Beautify file to beautify the entire file.
As shown in the picture is the effect after beautification. The code is automatically wrapped and formatted. This beautification operation supports source code in multiple formats.
The above is the detailed content of How to beautify code with vscode. For more information, please follow other related articles on the PHP Chinese website!