How does Unity let vscode automatically format C# code like vs

foreword

I have asked the Unity bosses what editor to use for Unity development before, and their answer is what is convenient to use (about the question of whether vscode is an ide... I think vscode is more like an editor with the core as the core, integrated through plug-ins achieve the effect of ide). Some big guys switched from vscode to vs because of the lack of code auto-completion (because manual formatting was required before), and VS has its own code formatting function, so it is better in code cleanliness and readability. There is also a switch from VS to vscode because it is faster.

I started using VS in 2018. At that time, I was just getting started. The whole interface has too many functions. I was persuaded to quit at the beginning... I have been familiar with VS for a long time. Later, I wrote front-end js, and ts began to contact vscode. The sour feeling seemed to be reduced from 150 pounds to 100 pounds. Now it seems that VS is indeed a bit bloated, and most developers use only a few functions.

code formatting

Recently, I suddenly discovered that vscode can automatically format the code without the need to manually right-click-format the document.

Before

insert image description here

Now

Open Settings
insert image description here
Text Editor - Formatting and check the corresponding content.
insert image description here
The code in the previous project forgot to format manually, and the readability is really bad.

Guess you like

Origin blog.csdn.net/weixin_44394801/article/details/120683449