nushell / nushell/nufmt

questions about intended behaviour regarding comments and empty lines

Open
#55 7 comments 0 reactions 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

Thanks so much for sharing this project! <3

I am testing this commit: https://github.com/nushell/nufmt/commit/4d578493d937c0b49bfd7f1c29a903e642732ab3

Test cases:

  • nufmt --stdin "# hello\n\n\nlet foo = 'abc'\n\n\n# goodbye"
output:
# hello
let foo = 'abc'

# goodbye
  • nufmt --stdin "# hello\n\n\n# goodbye"
output:
# hello


# goodbye

I understand the experimental/early nature of this project, and I'm a huge fan of nu, so I'm curious about what idiomatic code looks like regarding comments and empty lines:

  • should nufmt preserve all empty lines, or is it idiomatic to have gaps no larger than a single empty line?
  • is it idiomatic to have "floating comments" that have one or more empty lines between them and the nearest code?
  • is it idiomatic to have multiple "floating comments" in a sequence, separated by one or more empty lines?
  • is it idiomatic for all comments to always be anchored to the next nearest code (e.g. no empty lines in between)?

Cheers! <3

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

Start by reproducing the two nufmt --stdin examples from the issue at commit 4d578493d937c0b49bfd7f1c29a903e642732ab. Read the formatter behavior around comments and empty lines and review the comment thread for an agreed convention. The issue is done only once the intended behavior is decided and captured in an implementation or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.