8000 fish_indent: Collapse successive newlines by faho · Pull Request #10325 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

fish_indent: Collapse successive newlines#10325

Merged
faho merged 2 commits intofish-shell:masterfrom
faho:indent-successive-newlines
Feb 27, 2024
Merged

fish_indent: Collapse successive newlines#10325
faho merged 2 commits intofish-shell:masterfrom
faho:indent-successive-newlines

Conversation

@faho
Copy link
Member
@faho faho commented Feb 26, 2024

Description

This makes it so fish_indent turns a run of empty lines into one.

So if you have a file like

echo foo



echo bar

it will turn it into

echo foo

echo bar

but

echo foo
echo bar

is untouched.

As a special case, even a single newline at the beginning of a file, before any code, will be removed.

The second commit goes through our share/ to reformat our files according to the new style.

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

faho added 2 commits February 26, 2024 16:17
This makes it so code like

```fish
echo foo

echo bar
```

is collapsed into

```fish
echo foo

echo bar
```

One empty line is allowed, more is overkill.

We could also allow more than one for e.g. function endings.
@faho faho added this to the fish next-3.x milestone Feb 26, 2024
#CHECK:
#CHECK: {{ }}case alpha
#CHECK: {{ }}{{ }}echo sup
#CHECK:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to admit I am surprised by this change.

I'm not sure why it happens (do we synthesize an "end" token for this?), but honestly I'm okay with it.

@krobelus
Copy link
Contributor
krobelus commented Feb 27, 2024 via email

@faho faho merged commit 78c9482 into fish-shell:master Feb 27, 2024
@faho faho deleted the indent-successive-newlines branch February 27, 2024 15:25
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0