Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>qfmt — Quick FormatterNew to Visual Studio Code? Get it now.
qfmt — Quick Formatter

qfmt — Quick Formatter

Netvion

|
3 installs
| (0) | Free
Lightweight code formatter: trim whitespace, remove blank lines, sort imports, convert indentation and more. Fast, zero-config, works with any language.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

qfmt — Quick Formatter

Lightweight, fast, zero-config code formatter for VS Code. Clean up your code in one keystroke. No plugins, no dependencies, no configuration needed.


Why qfmt?

Most formatters are heavy, language-specific, and require complex configuration files. qfmt is different:

  • Zero config — Works out of the box, no .prettierrc, no .editorconfig needed
  • Any language — JavaScript, TypeScript, Python, Java, C#, Go, Rust, HTML, CSS, Markdown, and more
  • Blazing fast — Pure text transformations, no AST parsing, no external processes
  • Non-destructive — Only cleans formatting issues, never changes your logic

Features

Trim Trailing Whitespace

Removes invisible spaces and tabs at the end of every line. Keeps your diffs clean and your code consistent.

Remove Consecutive Blank Lines

Collapses 3+ blank lines into just one. No more huge gaps in your files.

Ensure Final Newline

Automatically adds a newline at the end of the file if missing. Follows POSIX standards.

Sort Imports (JS/TS)

Alphabetically sorts import and require() blocks. Groups are preserved and sorted independently.

Convert Indentation

Switch between tabs and spaces instantly across your entire file.

Format on Save

Enable automatic formatting every time you save. Set it once, forget about it.


Available Commands

Open the Command Palette (Ctrl+Shift+P) and type qfmt:

Command Description
qfmt: Format File Run all enabled formatters at once
qfmt: Trim Trailing Whitespace Remove trailing spaces/tabs
qfmt: Remove Consecutive Blank Lines Collapse multiple blank lines
qfmt: Sort Imports Sort import statements (JS/TS)
qfmt: Convert Tabs to Spaces Replace tabs with spaces
qfmt: Convert Spaces to Tabs Replace leading spaces with tabs

Keyboard Shortcut

Action Windows / Linux Mac
Format File Ctrl + Alt + Q Cmd + Alt + Q

Quick Start

  1. Install qfmt from the Extensions panel
  2. Open any file in VS Code
  3. Press Ctrl + Alt + Q
  4. Your file is now clean and formatted

That's it. No setup required.


Configuration

All settings are optional. qfmt works perfectly with the defaults.

Open Settings (Ctrl + ,) and search for qfmt:

Setting Type Default Description
qfmt.formatOnSave boolean false Auto-format when saving a file
qfmt.trimTrailingWhitespace boolean true Remove trailing spaces from lines
qfmt.ensureFinalNewline boolean true Add newline at end of file
qfmt.removeConsecutiveBlankLines boolean true Collapse 3+ blank lines into one
qfmt.sortImports boolean false Sort import/require statements
qfmt.tabSize number 4 Spaces per tab for conversion

Example settings.json

{
  "qfmt.formatOnSave": true,
  "qfmt.trimTrailingWhitespace": true,
  "qfmt.ensureFinalNewline": true,
  "qfmt.removeConsecutiveBlankLines": true,
  "qfmt.sortImports": true,
  "qfmt.tabSize": 2
}

Supported Languages

qfmt works with every language and file type supported by VS Code:

JavaScript, TypeScript, Python, Java, C, C++, C#, Go, Rust, PHP, Ruby, Swift, Kotlin, Dart, HTML, CSS, SCSS, LESS, JSON, YAML, XML, Markdown, SQL, Shell scripts, and more.


Status Bar

qfmt adds a small lightning bolt icon in the status bar. Click it to format the current file instantly.


Examples

TypeScript — Before

import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { ActivatedRoute } from '@angular/router';


import { Observable } from 'rxjs';



export class AppComponent {
    name:   string;


    constructor(private http: HttpClient) {
        this.name = 'hello';
    }
}

TypeScript — After Ctrl + Alt + Q

import { ActivatedRoute } from '@angular/router';
import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';

export class AppComponent {
    name:   string;

    constructor(private http: HttpClient) {
        this.name = 'hello';
    }
}

Trailing whitespace removed, consecutive blank lines collapsed, imports sorted alphabetically.


Java — Before

import java.util.Map;
import java.io.File;
import java.util.List;
import java.util.ArrayList;


import java.io.IOException;



public class UserService {


    private List<String> users;



    public UserService() {
        this.users = new ArrayList<>();
    }
}

Java — After Ctrl + Alt + Q

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class UserService {

    private List<String> users;

    public UserService() {
        this.users = new ArrayList<>();
    }
}

Imports sorted, trailing whitespace cleaned, blank lines normalized.


Others

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

License

MIT — Use it freely in personal and commercial projects.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft