Commit Graph

10 Commits

Author SHA1 Message Date
ridiculousfish
c79c92eb47 Fix fish_indent tests 2019-05-24 17:00:56 -07:00
Fabian Homborg
15c50703ce fish_indent: Allow semicolons for and and or
As mentioned in #2900, something like

```fish
test -n "$var"; and set -l foo $var
```

is sufficiently idiomatic that it should be allowable.

Also fixes some additional weirdness with semicolons.
2019-05-05 12:51:49 +02:00
Fabian Homborg
3bea947bb5 fish_indent: Ignore consecutive semicolons
This removes semicolons at the end of the line and collapses
consecutive ones, while replacing meaningful semicolons with newlines.

I.e.

```fish
echo;
```

becomes

```fish
echo
```

but

```fish
echo; echo
```

becomes

```fish
echo
echo
```

Fixes #5859.
2019-05-05 12:07:38 +02:00
ridiculousfish
98d736f916 Teach fish_indent about escaped newlines
Correctly indents code like:

   alpha | \
     # comment
     beta
2018-05-07 21:40:53 -07:00
Kurtis Rader
59f0261dba enhance fish_indent to normalize keywords
Fish keywords can be quoted and split across lines. Prior to this change
`fish_indent` would retain such odd, obfuscated, formatting. This change
results in all keywords being converted to their canonical form.

This required fixing a bug: the keyword member of parse_node_t wasn't being
populated. This hadn't been noticed prior to now because it wasn't used.

Fixes #2921
2016-04-10 18:40:11 -07:00
Kurtis Rader
4ff8e6e781 change how redirections are formatted
Modify `fish_indent` to emit redirections without a space before the target of
the redirection; e.g., "2>&1" rather than "2>& 1" as the former is clearer to
humans.

Fixes #2899
2016-04-05 19:29:23 -07:00
Kurtis Rader
8b67a1b26f make testing on local servers hermetic
I noticed while fixing issue #2702 that the fish program being tested
was sourcing config.fish files outside of the current build. This also
happens when Travis CI runs the tests but isn't an issue there because
of how Travis is configured to execute the tests.

I also noticed that running `make test` was polluting my personal fish
history; which will become a bigger problem if and when the fishd universal
var file is moved from $XDG_CONFIG_HOME to $XDG_DATA_HOME.

This change makes it possible for an individual to run the tests on
their local machine secure in the knowledge that only the config.fish and
related files from their git repository will be used and doing so won't
pollute their personal fish history.

Resolves #469
2016-02-25 17:16:36 -08:00
ridiculousfish
a21db45cee Improve indentation of blocks inside if/while headers
Fixes #1665
2014-12-23 16:30:39 -08:00
ridiculousfish
6fa9a18a2b Correct path in fish_indent tests 2014-12-23 15:51:18 -08:00
ridiculousfish
da2e2c2e99 Implement tests for fish_indent 2014-12-23 15:46:47 -08:00