Skip to content

Commit 1e5a257

Browse files
authored
blocks: add double single quote block recognition (#78)
Nix multi line strings use double single quotes. Adding this to the list of quotes that indicate blocks. Signed-off-by: Paul Meyer <katexochen0@gmail.com>
1 parent 421ebc4 commit 1e5a257

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

goldens/block.in

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,19 @@ some_build_rule(
137137
src = "one-more-source",
138138
)
139139
// keep-sorted-test end
140+
141+
// Nix multi line string
142+
// keep-sorted-test start block=yes newline_separated=yes
143+
foo = throw ''
144+
Some text here.
145+
146+
Text has empty lines.
147+
'';
148+
149+
bar = ''
150+
While foo throws, this is just a string
151+
152+
153+
Again, with some spaces here and there.
154+
'';
155+
// keep-sorted-test end

goldens/block.out

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,19 @@ some_build_rule(
137137
src = "another-source",
138138
)
139139
// keep-sorted-test end
140+
141+
// Nix multi line string
142+
// keep-sorted-test start block=yes newline_separated=yes
143+
bar = ''
144+
While foo throws, this is just a string
145+
146+
147+
Again, with some spaces here and there.
148+
'';
149+
150+
foo = throw ''
151+
Some text here.
152+
153+
Text has empty lines.
154+
'';
155+
// keep-sorted-test end

keepsorted/line_group.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ var (
216216
}
217217
quotes = []string{
218218
`"""`, `'''`, "```",
219-
`"`, `'`, "`",
219+
`"`, `''`, `'`, "`",
220220
}
221221
)
222222

0 commit comments

Comments
 (0)