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

How does vscode format the code

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

Share

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

This article mainly introduces how to format the code in vscode, which can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

The shortcut keys for vs code format code are as follows:

Shift+ Alt+F on Windows

Shift+ Option+F on Mac

Ctrl+ Shift+I on Ubuntu

But the built-in format can not meet my needs, at this time, I have to say that the plug-in is good.

The code is formatted in eslint style

Plug-in required: eslint

Add to the settings:

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

Eslint.autoFixOnSave is used to format automatically when saved, but only javascript .js files are supported by default.

The file type used by eslint.validate to configure the role.

Then when you save the code, it is automatically formatted in eslint style (you need to save it multiple times).

Thank you for reading this article carefully. I hope it will be helpful for everyone to share how vscode formats the code content. At the same time, I also hope you can support us, pay attention to the industry information channel, and find out if you have any problems. Detailed solutions are waiting for you to learn!

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