Our team uses both VSCode and WebStorm for development, so need to create a same code formatting style for both IDEs.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With