

The Prettier formatter allows configuration as well. Formatters can also have preferences of their own, so for example, I set the option to preserve-aligned to make the built-in HTML formatter preserve alignment of HTML attributes. This can be achieved by selecting the formatter per language in the way mentioned above. I like to use the Prettier formatter (through an extension) for JavaScript and CSS, while using the built-in formatter for HTML. A small example may serve to point out one I personally came across. Here, you will find a setting called faultFormatter - you can either change this to what you want, using the available smart suggestions, or remove the setting altogether, and the next time you try to format a file, VS Code will ask you which formatter to use. This is done by running the command “Preferences: Configure Language Specific Settings…”, and selecting the relevant language.
VISUAL STUDIO CODE COLLAPSE ALL FOLDERS INSTALL
If you later change your mind or if you install a new formatter you want to use for that file type, you can change the default formatter. The first time you choose to format a file, if you have multiple formatters for that file type installed, VS Code will ask you which formatter to use, and remember your choice for the future.

Extensions can add formatters for these and other languages. VS Code has commands for formatting the active file and the selected text, and built-in formatters for JavaScript, TypeScript, JSON and HTML. The reason is that auto-formatting replaces quite a few editing operations - instead of wrangling with editing shortcuts to get your code lined up, correctly wrapped and looking good, you just input your code without regard for formatting, hit a keyboard shortcut to format the file, and you’re good. code-workspace file - this is the file VS Code prompts you to save as you close a multi-folder workspace.Īutomatic code formatting is listed here, but it could just as well have been in the article on editing. vscode, but you can also have settings that apply to the whole workspace in the. With a multiple-folder workspace, you can still have folder-specific settings in. If you change settings for your current workspace in VS Code, the settings will usually be saved inside the. VS Code will prompt you to do this as you close the workspace. In this case, ⌃ + r won’t remember this workspace unless you explicitly save it in a file. You can add multiple folders to a workspace, for example if your project involves working on a client and a server component simultaneously. Switching between projects using "Quick Open Recent".Ī workspace starts with you opening a folder in VS Code, but workspaces are not limited to a single root folder. The list is split into recent workspaces and recent files. This means ⌃ + r functions as a quick way to switch between projects - press it, type some characters of the project name, and hit enter. ⌃ + r will bring up a list that let’s you quickly switch between recent files, but the list also includes workspaces. VS Code has a concept of workspaces - usually, a workspace is just the root folder of your project.
