nushell / nushell/nufmt

extra line after comments breaks pipelines

Open
#213 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
230
Forks
40
Avg merge
15h 30m
Merged PRs (30d)
1

Description

Describe the bug

Nufmt adds a newline after comments, potentially breaking pipelines.

Script or statement
$env.config = $env.config
# | upsert edit_mode vi
| upsert show_banner false
Actual behavior/output
$env.config = $env.config
# | upsert edit_mode vi

| upsert show_banner false

The newline added after the comment breaks the pipeline:

Error: nu::parser::input_type_mismatch

  × Command does not support nothing input.
   ╭─[/home/pheenty/a.nu:4:3]
 3 │
 4 │ | upsert show_banner false
   ·   ───┬──
   ·      ╰── command doesn't support nothing input
   ╰────
Expected behavior/output
$env.config = $env.config
# | upsert edit_mode vi
| upsert show_banner false

(nothing should change)

Environment
❯ $nu.os-info
╭────────────────┬───────────────╮
│ name           │ linux         │
│ arch           │ x86_64        │
│ family         │ unix          │
│ kernel_version │ 7.1.8-arch1-3 │
╰────────────────┴───────────────╯
❯ nufmt --version
nufmt 0.1.4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run nufmt 0.1.4 on the supplied Nushell script and compare its output with the expected example. Trace the formatter entry point that handles comments and pipeline lines, then add or update coverage for this reproduction. Done means formatting leaves the comment and following pipeline command adjacent, without introducing a blank line.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.