From 243b62a1e6f69b88404ed258ac36d7fe759e7212 Mon Sep 17 00:00:00 2001 From: Erin van der Veen Date: Thu, 13 Jul 2023 14:02:51 +0200 Subject: [PATCH] Append scope to node before annotation Resolves #571 by only checking if the annotation itself started on a new line --- topiary/languages/nickel.scm | 2 +- topiary/tests/samples/expected/nickel.ncl | 12 ++++++++++++ topiary/tests/samples/input/nickel.ncl | 10 ++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/topiary/languages/nickel.scm b/topiary/languages/nickel.scm index 140514c4..7e57da99 100644 --- a/topiary/languages/nickel.scm +++ b/topiary/languages/nickel.scm @@ -274,7 +274,7 @@ ; id | a -> a ( (#scope_id! "annotations") - (_) @prepend_begin_scope + (_) @append_begin_scope . (annot) @append_end_scope ) diff --git a/topiary/tests/samples/expected/nickel.ncl b/topiary/tests/samples/expected/nickel.ncl index 2bf474e1..96fd3e84 100644 --- a/topiary/tests/samples/expected/nickel.ncl +++ b/topiary/tests/samples/expected/nickel.ncl @@ -10,6 +10,18 @@ id | a -> a }, + #571 + { + b = + { + kind = 'ReplicationController, + } | KubernetesConfig, + c = + { + kind = 'ReplicationController, + } + | KubernetesConfig + }, # Interpolated record operation chains (in # a multi-line comment) diff --git a/topiary/tests/samples/input/nickel.ncl b/topiary/tests/samples/input/nickel.ncl index 38f7360e..e0e94768 100644 --- a/topiary/tests/samples/input/nickel.ncl +++ b/topiary/tests/samples/input/nickel.ncl @@ -10,6 +10,16 @@ id | a -> a }, + #571 + { + b = { + kind = 'ReplicationController, + } | KubernetesConfig, + c = { + kind = 'ReplicationController, + } + | KubernetesConfig + }, # Interpolated record operation chains (in # a multi-line comment)