Skip to content

Commit 615fe16

Browse files
committed
refactor: - Make white-space between sort and group explanations same as for filters
The extra blank line makes the explanations readable with custom sorting and grouping, where the continuation characters and/or placeholders are used.
1 parent 9f25b94 commit 615fe16

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Query/Explain/Explainer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ export class Explainer {
6161
return this.indent('No grouping instructions supplied.\n');
6262
}
6363

64-
return query.grouping.map((group) => group.statement.explainStatement(this.indentation)).join('\n') + '\n';
64+
return query.grouping.map((group) => group.statement.explainStatement(this.indentation)).join('\n\n') + '\n';
6565
}
6666

6767
public explainSorters(query: Query) {
6868
if (query.sorting.length === 0) {
6969
return this.indent('No sorting instructions supplied.\n');
7070
}
7171

72-
return query.sorting.map((sort) => sort.statement.explainStatement(this.indentation)).join('\n') + '\n';
72+
return query.sorting.map((sort) => sort.statement.explainStatement(this.indentation)).join('\n\n') + '\n';
7373
}
7474

7575
public explainQueryLimits(query: Query) {

tests/Query/Explain/Explainer.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ limit groups 3
7575
description includes some
7676
7777
group by priority reverse
78+
7879
group by happens
7980
8081
sort by description reverse
82+
8183
sort by path
8284
8385
At most 50 tasks.
@@ -104,9 +106,11 @@ limit groups 3
104106
description includes some
105107
106108
group by priority reverse
109+
107110
group by happens
108111
109112
sort by description reverse
113+
110114
sort by path
111115
112116
At most 50 tasks.
@@ -178,7 +182,9 @@ describe('explain groupers', () => {
178182
const query = new Query(source);
179183
expect(explainer.explainGroups(query)).toMatchInlineSnapshot(`
180184
"group by due
185+
181186
group by status.name reverse
187+
182188
group by function task.description.toUpperCase()
183189
"
184190
`);
@@ -227,6 +233,7 @@ describe('explain sorters', () => {
227233
const query = new Query(source);
228234
expect(explainer.explainSorters(query)).toMatchInlineSnapshot(`
229235
"sort by due
236+
230237
sort by priority()
231238
"
232239
`);

0 commit comments

Comments
 (0)