Fix aggressive indent in shell scripts (#31973)

Closes: https://github.com/zed-industries/zed/issues/31774

Release Notes:

- N/A

Co-authored-by: Ben Kunkle <ben.kunkle@gmail.com>
This commit is contained in:
Peter Tripp 2025-06-03 10:50:58 -04:00 committed by GitHub
parent a9d99d8347
commit ae210eced8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -49,6 +49,14 @@ mod tests {
assert_eq!(buffer.text(), expected); assert_eq!(buffer.text(), expected);
}; };
// Do not indent after shebang
expect_indents_to(
&mut buffer,
cx,
"#!/usr/bin/env bash\n#",
"#!/usr/bin/env bash\n#",
);
// indent function correctly // indent function correctly
expect_indents_to( expect_indents_to(
&mut buffer, &mut buffer,

View file

@ -29,6 +29,6 @@ brackets = [
### bar ### bar
### fi ### fi
### ``` ### ```
increase_indent_pattern = "(\\s*|;)(do|then|in|else|elif)\\b.*$" increase_indent_pattern = "(^|\\s+|;)(do|then|in|else|elif)\\b.*$"
decrease_indent_pattern = "(\\s*|;)\\b(fi|done|esac|else|elif)\\b.*$" decrease_indent_pattern = "(^|\\s+|;)(fi|done|esac|else|elif)\\b.*$"
# make sure to test each line mode & block mode # make sure to test each line mode & block mode