Conditional Format is a Visual Studio Code extension that combines the functionality of Format Selection and Format Document keybinds into a single command. When a code block is selected, the extension formats only the selected code. If no text is selected, the extension formats the entire document. This extension utilizes the built-in formatters provided by VSCode, as well as any other formatter extensions you have installed.
Format a selected code block in the active text editor
Format the entire document if no text is selected
Select a code block in the active text editor or leave the selection empty to format the entire document
Press CTRL+K CTRL+D or CMD+K CMD+D (macOS) on macOS to format the selected code block or the entire document