Commit 10310be
fix: Fix statement counting and case-insensitive GO matching for \sx
Fixed three critical issues with the execute-statement-at-cursor (\sx) feature:
1. Statement counting bug: Changed from counting GO separators before cursor
to finding which statement block contains the cursor. GO ends a statement,
not starts it, so cursor position must be compared to GO locations to
determine which statement block the cursor is in.
2. Case-insensitive GO matching: Added .upper() before regex match to accept
both 'GO' and 'go' as statement terminators in Neovim plugin.
3. Data file requirement: Removed mandatory data file requirement for
--execute-statement mode. Now uses DUAL table when no data file is provided,
allowing WEB CTEs and queries without data files to work correctly.
Testing:
- Verified with lowercase 'go' separators: correctly identifies statement numbers
- Verified with WEB CTE scripts: no longer requires CSV data file
- Verified dependency analysis: correctly shows "Executing statement #2 with 1 dependencies"
Files changed:
- nvim-plugin/lua/sql-cli/executor.lua: Fixed statement counting logic and case-insensitive GO matching
- src/main.rs: Use DUAL table when no data file provided
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 3a8d833 commit 10310be
2 files changed
Lines changed: 25 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
490 | 495 | | |
491 | | - | |
| 496 | + | |
| 497 | + | |
492 | 498 | | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
493 | 503 | | |
494 | 504 | | |
495 | 505 | | |
496 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
497 | 510 | | |
498 | 511 | | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
499 | 515 | | |
500 | 516 | | |
501 | 517 | | |
502 | 518 | | |
503 | 519 | | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
504 | 524 | | |
505 | 525 | | |
506 | 526 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
800 | 800 | | |
801 | 801 | | |
802 | 802 | | |
803 | | - | |
| 803 | + | |
804 | 804 | | |
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
808 | 808 | | |
809 | 809 | | |
810 | 810 | | |
811 | | - | |
812 | | - | |
813 | | - | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
814 | 814 | | |
815 | 815 | | |
816 | 816 | | |
| |||
0 commit comments