Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>NewLineNew to Visual Studio Code? Get it now.
NewLine

NewLine

Feng Chang

|
4,411 installs
| (0) | Free
Whenever you save a file, this extension will automatically add a blank line at its end, if there isn't one already. If you have multiple blank lines, only one will be kept.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

NewLine

Visual Studio Marketplace Version CI License: MIT

Automatically ensures every file ends with exactly one blank line when saved. No more missing newlines or multiple trailing blank lines.

Features

  • Auto-fix on save — adds a trailing newline if the file doesn't end with one
  • Cleans up extra blank lines — if a file ends with multiple blank lines, they are collapsed to a single one
  • Handles both LF and CRLF — works correctly regardless of the file's line ending style
  • Skips empty files — files with no content are left untouched
  • Skips whitespace-only files — files containing only newlines can be ignored (configurable)
  • Manual command — run NewLine: Check Newline from the Command Palette to fix the active file on demand
  • Flexible ignore rules — exclude files by extension or by regular expression

Installation

Search for NewLine in the VS Code Marketplace and click Install, or run:

ext install chang196700.newline

Usage

The extension activates automatically. Every time you save a file, it checks and fixes the trailing newline.

To trigger a check manually, open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run:

NewLine: Check Newline

Configuration

Setting Type Default Description
newline.ignoreOnlyNewlinesFile boolean true Skip files whose entire content is only newline characters
newline.fileExtensionsToIgnore string[] [".conf", ".json", ".liquid"] File extensions that should not be modified
newline.fileRegexToIgnore object[] [] Regex rules to ignore files by name pattern

newline.fileExtensionsToIgnore

List of file extensions to skip. The check is a simple suffix match on the full filename.

// settings.json
"newline.fileExtensionsToIgnore": [
    ".conf",
    ".json",
    ".liquid",
    ".min.js"   // you can add any extension
]

newline.fileRegexToIgnore

Each entry is an object with two fields:

Field Values Description
type "basename" | "fullName" Match against the filename only, or the full absolute path
regex string A JavaScript-compatible regular expression
// settings.json
"newline.fileRegexToIgnore": [
    // ignore any file named exactly "Makefile"
    { "type": "basename", "regex": "^Makefile$" },

    // ignore all files under a "vendor" directory
    { "type": "fullName", "regex": "[/\\\\]vendor[/\\\\]" },

    // ignore all .min.* files
    { "type": "basename", "regex": "\\.min\\." }
]

newline.ignoreOnlyNewlinesFile

When set to true (the default), files whose entire content consists only of newline characters are left untouched. Set to false to strip those newlines as well.

Issues & Feedback

Found a bug or have a suggestion? Please open an issue.

Contributing

pnpm install       # install dependencies (requires Node.js with corepack enabled)
pnpm run compile   # compile TypeScript
pnpm run lint      # run linter
pnpm run test      # run tests (requires a display; set DISPLAY=:99.0 on Linux)

Commit messages must follow Conventional Commits — releases are automated via Semantic Release.

Credits

Inspired by vsCodeBlankLine.

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