Skip to content

Commit cd61155

Browse files
authored
lsp: don't use ansi codes in output (#680)
rel: #679
1 parent c23fd32 commit cd61155

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

PLAN.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ example:
7373

7474
```sql
7575
-- some query comment
76-
SELECT name username, email,
76+
SELECT name username, "email",
7777
"weird-column-name"
7878
FROM bar
7979
```
@@ -96,6 +96,7 @@ config ideas:
9696

9797
- lower / upper case keywords (default lowercase)
9898
- indent (default 2)
99+
- quoted idents (default avoid)
99100

100101
links:
101102

@@ -421,12 +422,30 @@ related: https://eslint.style/rules/no-extra-parens
421422

422423
should support various fixes so people can write in one dialect of SQL and have it easily convert to the other one
423424

425+
### Rule: group by all
426+
427+
[requires pg >=19](https://www.depesz.com/2025/10/02/waiting-for-postgresql-19-add-group-by-all/)
428+
429+
```sql
430+
SELECT customer_id, merchant_id, request_id, count(*) from t
431+
group by 1, 2, 3;
432+
-- ^^^^^^^ implicit group by all
433+
```
434+
435+
becomes:
436+
437+
```sql
438+
SELECT customer_id, merchant_id, request_id, count(*) from t
439+
group by all;
440+
```
441+
424442
### Rule: unused column
425443

426444
```sql
427445
SELECT customer_id, total_amount
428446
FROM (
429447
SELECT customer_id, SUM(amount) AS total_amount, min(created_at)
448+
-- ^^^^^^^^^^^^^^^ unused
430449
FROM orders
431450
GROUP BY customer_id
432451
) AS customer_totals

crates/squawk/src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,17 @@ Please open an issue at https://github.com/sbdchd/squawk/issues/new with the log
168168
let opts = Opt::parse();
169169

170170
if opts.verbose {
171+
// ANSI codes don't render properly in the VSCode output pane
172+
let color_choice = if matches!(opts.cmd, Some(Command::Server)) {
173+
simplelog::ColorChoice::Never
174+
} else {
175+
simplelog::ColorChoice::Auto
176+
};
171177
CombinedLogger::init(vec![simplelog::TermLogger::new(
172178
simplelog::LevelFilter::Info,
173179
simplelog::Config::default(),
174180
simplelog::TerminalMode::Stderr,
175-
simplelog::ColorChoice::Auto,
181+
color_choice,
176182
)])
177183
.expect("problem creating logger");
178184
}

0 commit comments

Comments
 (0)