Commit 95aee88
feat(llm): improve SQL formatting with proper column layout
Enhanced SQL formatter to ensure each SELECT column/expression is on
its own line with proper indentation. This makes complex queries much
more readable.
Changes to layoutClauses:
- Track baseIndent level to handle nested queries
- Each column after SELECT gets its own line with proper indentation
- Subqueries are detected and indented appropriately
- Works with arbitrarily nested queries
Example output:
SELECT name,
budget_cents,
actual_cents
FROM projects
WHERE status = 'active'
Added test for nested subqueries to verify column layout with inline
scalar subqueries.
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent bccfcc4 commit 95aee88
2 files changed
+66
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
| 348 | + | |
| 349 | + | |
348 | 350 | | |
349 | 351 | | |
350 | 352 | | |
351 | 353 | | |
352 | | - | |
| 354 | + | |
353 | 355 | | |
354 | 356 | | |
355 | 357 | | |
| 358 | + | |
356 | 359 | | |
357 | | - | |
358 | | - | |
| 360 | + | |
| 361 | + | |
359 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
360 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
361 | 378 | | |
| 379 | + | |
362 | 380 | | |
363 | 381 | | |
364 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
365 | 388 | | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
366 | 392 | | |
367 | 393 | | |
368 | | - | |
| 394 | + | |
369 | 395 | | |
370 | 396 | | |
371 | 397 | | |
372 | | - | |
373 | | - | |
| 398 | + | |
374 | 399 | | |
375 | 400 | | |
376 | 401 | | |
377 | 402 | | |
| 403 | + | |
378 | 404 | | |
379 | 405 | | |
380 | 406 | | |
381 | 407 | | |
382 | 408 | | |
383 | 409 | | |
384 | 410 | | |
385 | | - | |
| 411 | + | |
386 | 412 | | |
387 | 413 | | |
388 | 414 | | |
389 | | - | |
| 415 | + | |
390 | 416 | | |
391 | 417 | | |
392 | 418 | | |
393 | 419 | | |
394 | 420 | | |
395 | | - | |
| 421 | + | |
396 | 422 | | |
397 | 423 | | |
| 424 | + | |
398 | 425 | | |
399 | 426 | | |
400 | 427 | | |
401 | 428 | | |
402 | 429 | | |
403 | 430 | | |
404 | | - | |
| 431 | + | |
| 432 | + | |
405 | 433 | | |
406 | 434 | | |
407 | 435 | | |
408 | | - | |
| 436 | + | |
409 | 437 | | |
410 | 438 | | |
411 | 439 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
67 | 85 | | |
68 | 86 | | |
69 | 87 | | |
| |||
84 | 102 | | |
85 | 103 | | |
86 | 104 | | |
87 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
88 | 109 | | |
89 | 110 | | |
90 | 111 | | |
| |||
109 | 130 | | |
110 | 131 | | |
111 | 132 | | |
112 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
113 | 138 | | |
114 | 139 | | |
115 | 140 | | |
| |||
0 commit comments