NewLineAutomatically ensures every file ends with exactly one blank line when saved. No more missing newlines or multiple trailing blank lines. Features
InstallationSearch for NewLine in the VS Code Marketplace and click Install, or run:
UsageThe 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 (
Configuration
|
| 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.