The HTTP formatter was adding extra newlines around variable names, named requests, and comments, making the formatted output unnecessarily verbose.
# Variables - BEFORE formatting
@hostname = api.example.com
@port = 8080
@host = {{hostname}}:{{port}}
# This is a comment
# @name getUserInfo
GET https://example.com/user# Variables - BEFORE formatting
@hostname = api.example.com
@port = 8080
@host = {{hostname}}:{{port}}
# This is a comment
# @name getUserInfo
GET https://example.com/user- Variables are grouped together - No extra blank lines between consecutive variable definitions
- Comments are grouped with variables - Comments and variables can be grouped together when they appear consecutively
- Named requests are grouped with comments -
# @namedirectives are grouped with other comments - HTTP requests still properly separated - Actual HTTP requests maintain proper spacing with blank lines before them
- Separators (###) maintain proper spacing - Request blocks separated by
###still have appropriate blank lines
The formatter now uses intelligent grouping logic:
- Variables, comments, and named requests can be grouped together with single newlines
- HTTP requests are separated from other elements with double newlines
- Separators (
###) properly flush groups and maintain spacing
This results in cleaner, more compact formatting while maintaining readability and proper structure.