-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
944b0d8
commit 9298b3a
Showing
3 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
((function_definition name: (_) option: (_) @cursor) @endable @indent (#endwise! "end" )) | ||
((function_definition name: (_) @cursor) @endable @indent (#endwise! "end" )) | ||
((while_statement condition: (_) @cursor) @endable @indent (#endwise! "end")) | ||
((for_statement variable: (_) value: (_) @cursor) @endable @indent (#endwise! "end")) | ||
((begin_statement (_) @cursor) @endable @indent (#endwise! "end")) | ||
((switch_statement (_) @cursor) @endable @indent (#endwise! "end")) | ||
((if_statement condition: (_) @cursor) @endable @indent (#endwise! "end")) | ||
|
||
((ERROR ("function" . (_)+ @cursor) @indent) (#endwise! "end" )) | ||
((ERROR ("while" . (_) @cursor) @indent) (#endwise! "end")) | ||
((ERROR ("for" . (_) . "in" . (_) @cursor) @indent) (#endwise! "end")) | ||
((ERROR ("begin" @cursor) @indent) (#endwise! "end")) | ||
((ERROR ("switch" . (_) @cursor) @indent) (#endwise! "end")) | ||
((ERROR ("if" . (_) @cursor) @indent) (#endwise! "end")) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
config({ | ||
extension: "fish", | ||
overrides: <<~INIT_LUA | ||
vim.opt.expandtab = true | ||
vim.opt.shiftwidth = 2 | ||
INIT_LUA | ||
}) | ||
|
||
test "fish, global function", <<~END | ||
-function foo█ | ||
+function foo | ||
+ | ||
+end | ||
END | ||
|
||
test "fish, global function with options", <<~END | ||
-function foo --on-signal WINCH█ | ||
+function foo --on-signal WINCH | ||
+ | ||
+end | ||
END | ||
|
||
test "fish, while loop", <<~END | ||
-while true█ | ||
+while true | ||
+ | ||
+end | ||
END | ||
|
||
test "fish, for loop generic clause", <<~END | ||
-for i in (seq 1 5)█ | ||
+for i in (seq 1 5) | ||
+ | ||
+end | ||
END | ||
|
||
test "fish, if stmt", <<~END | ||
-if foo█ | ||
+if foo | ||
+ | ||
+end | ||
END | ||
|
||
test "fish, nested global function", <<~END | ||
-function foobarbaz | ||
- function foo█ | ||
-end | ||
+function foobarbaz | ||
+ function foo | ||
+ | ||
+ end | ||
+end | ||
END | ||
|
||
test "fish, nested global function with options", <<~END | ||
-function foobarbaz --on-signal WINCH | ||
- function foo█ | ||
-end | ||
+function foobarbaz --on-signal WINCH | ||
+ function foo | ||
+ | ||
+ end | ||
+end | ||
END | ||
|
||
test "fish, nested global function with inner options", <<~END | ||
-function foobarbaz | ||
- function foo --on-signal WINCH█ | ||
-end | ||
+function foobarbaz | ||
+ function foo --on-signal WINCH | ||
+ | ||
+ end | ||
+end | ||
END | ||
|
||
test "fish, nested while loop", <<~END | ||
-function foobarbaz | ||
- while true█ | ||
-end | ||
+function foobarbaz | ||
+ while true | ||
+ | ||
+ end | ||
+end | ||
END | ||
|
||
test "fish, nested for loop loop", <<~END | ||
-function foobarbaz | ||
- for i in (seq 1 5)█ | ||
-end | ||
+function foobarbaz | ||
+ for i in (seq 1 5) | ||
+ | ||
+ end | ||
+end | ||
END | ||
|