From f84de0d6cd3199149c1c4c236b7267ce7b0775a2 Mon Sep 17 00:00:00 2001 From: Alex Manning Date: Sat, 3 Jun 2023 21:39:20 -0400 Subject: [PATCH] fix(gleam): minor indent fixes --- queries/gleam/indents.scm | 2 +- tests/indent/gleam/anonymous_function.gleam | 7 +++++++ tests/indent/gleam_spec.lua | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/indent/gleam/anonymous_function.gleam diff --git a/queries/gleam/indents.scm b/queries/gleam/indents.scm index 9bfd2952b..0eef75129 100644 --- a/queries/gleam/indents.scm +++ b/queries/gleam/indents.scm @@ -1,5 +1,6 @@ ; Gleam indents similar to Rust and JavaScript [ + (anonymous_function) (assert) (case) (case_clause) @@ -11,7 +12,6 @@ (let) (list) (constant) - (external_function) (function) (type_definition) (type_alias) diff --git a/tests/indent/gleam/anonymous_function.gleam b/tests/indent/gleam/anonymous_function.gleam new file mode 100644 index 000000000..bcbdc2394 --- /dev/null +++ b/tests/indent/gleam/anonymous_function.gleam @@ -0,0 +1,7 @@ +fn() { + fn() { + fn() { + True + } + } +} diff --git a/tests/indent/gleam_spec.lua b/tests/indent/gleam_spec.lua index da0c86c57..8de57fd50 100644 --- a/tests/indent/gleam_spec.lua +++ b/tests/indent/gleam_spec.lua @@ -115,5 +115,13 @@ describe("indent Gleam:", function() run:new_line("todo.gleam", { on_line = 3, text = "//", indent = 4 }) run:new_line("todo.gleam", { on_line = 4, text = "//", indent = 2 }) run:new_line("todo.gleam", { on_line = 5, text = "//", indent = 0 }) + + run:new_line("anonymous_function.gleam", { on_line = 1, text = "//", indent = 2 }) + run:new_line("anonymous_function.gleam", { on_line = 2, text = "//", indent = 4 }) + run:new_line("anonymous_function.gleam", { on_line = 3, text = "//", indent = 6 }) + run:new_line("anonymous_function.gleam", { on_line = 4, text = "//", indent = 6 }) + run:new_line("anonymous_function.gleam", { on_line = 5, text = "//", indent = 4 }) + run:new_line("anonymous_function.gleam", { on_line = 6, text = "//", indent = 2 }) + run:new_line("anonymous_function.gleam", { on_line = 7, text = "//", indent = 0 }) end) end)