Skip to content

Commit 93eada1

Browse files
committed
fix: comma between rows in table
1 parent c70be32 commit 93eada1

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

languages/nu.scm

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@
121121
(parameter_pipes) @append_space @append_spaced_softline
122122

123123
(parameter
124-
param_long_flag: _? @prepend_space
125-
.
126-
flag_capsule: _? @prepend_space
124+
flag_capsule: _ @prepend_space
127125
)
128126

129127
;; Comma/newline between parameters
@@ -354,22 +352,36 @@
354352
entry: _ @append_begin_scope
355353
.
356354
entry: _ @prepend_spaced_softline @prepend_end_scope
357-
(#multi_line_only!)
358355
(#scope_id! "consecutive_scope")
356+
(#multi_line_only!)
359357
)
360358

361359
(record_body
362360
entry: _ @append_delimiter
363-
(#multi_line_only!)
364361
(#delimiter! ",")
362+
(#multi_line_only!)
365363
)
366364

367365
(record_body
368366
entry: _ @append_begin_scope
369367
.
370368
entry: _ @prepend_spaced_softline @prepend_end_scope
371-
(#multi_line_only!)
372369
(#scope_id! "consecutive_scope")
370+
(#multi_line_only!)
371+
)
372+
373+
(val_table
374+
row: _ @append_delimiter
375+
.
376+
row: _
377+
(#delimiter! ", ")
378+
(#single_line_only!)
379+
)
380+
381+
(val_table
382+
row: _ @append_delimiter @prepend_spaced_softline
383+
(#delimiter! ",")
384+
(#multi_line_only!)
373385
)
374386

375387
(ctrl_match
@@ -397,10 +409,6 @@
397409
(#delimiter! ",")
398410
)
399411

400-
(val_table
401-
row: _ @prepend_spaced_softline
402-
)
403-
404412
;; type notation
405413
(collection_type
406414
[

test/expected_data.nu

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,12 @@ export const config = {
247247
],
248248
}
249249

250-
const table = [[a, b]; [1, 2] [2, [4, 4]]]
250+
const table = [[a, b]; [1, 2], [2, [4, 4]]]
251+
const multi_line_table = [
252+
[a, b];
253+
[1, 2],
254+
[2, [4, 4]],
255+
]
251256
const table_no_row = [[a, b]; ]
252257

253258
mut foo: record<"a", b, "c": int, d: list<any>> = {}

test/expected_decl.nu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ module greetings {
6868
};
6969

7070
# https://github.com/blindFS/topiary-nushell/issues/35
71-
def f [--arg1: number --arg2: string] { }
71+
def f [--arg1: number, --arg2: string] { }

test/input_data.nu

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ export const config = {
248248
}
249249

250250
const table = [[a b]; [1 2] [2 [4 4]]]
251+
const multi_line_table = [[a b]; [1 2]
252+
[2 [4 4]]]
251253
const table_no_row = [[a b];]
252254

253255
mut foo : record<"a", b "c": int d: list<any>> = {}

0 commit comments

Comments
 (0)