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:
parent
a9d99d8347
commit
ae210eced8
2 changed files with 10 additions and 2 deletions
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue