Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set same code formatting styles to WebStorm and VSCode?

Our team uses both VSCode and WebStorm for development, so need to create a same code formatting style for both IDEs.

like image 346
Chandima Gunawardhana Avatar asked Mar 29 '19 07:03

Chandima Gunawardhana


People also ask

Is WebStorm better than Visual Studio Code?

WebStorm is generally more efficient at refactoring and testing JavaScript and JavaScript-based code (such as TypeScript). Refactoring optimizes code for efficiency, while unit testing ensures product quality. VS Code still provides these features — but they aren't tailored to JavaScript.

How do I set the default formatter in my VS Code settings?

Now, highlight your code and right-click. Select Format Document. Once you click on Format Document, a dialog box will tell you to configure your code formatter. This is to set your default code formatter.

How do you correct formatting in VS Code?

VS Code has great support for source code formatting. The editor has two explicit format actions: Format Document (Ctrl+Shift+I) - Format the entire active file. Format Selection (Ctrl+K Ctrl+F) - Format the selected text.


1 Answers

I would recommend formatting your code with Prettier. There's a plugin for VSCode and WebStorm. If you add Prettier as a dependency in package.json (with a specific version) you will make sure that both editors invoke the exact same formatting command.

like image 95
torkel Avatar answered Sep 18 '22 16:09

torkel