Skip to content

feat: auto-uppercase SQL keywords as you type#664

Merged
datlechin merged 1 commit intomainfrom
feat/auto-uppercase-keywords
Apr 10, 2026
Merged

feat: auto-uppercase SQL keywords as you type#664
datlechin merged 1 commit intomainfrom
feat/auto-uppercase-keywords

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

Closes #660

Summary

  • Add "Auto-uppercase keywords" toggle in Settings → Editor (off by default)
  • When enabled, SQL keywords auto-convert to uppercase when the user types a word boundary (space, tab, newline, (, ), ,, ;)
  • Keywords inside strings, comments, and backtick-quoted identifiers are left alone
  • Handles backslash-escaped quotes (\') correctly
  • Uses textStorage.replaceCharacters directly (not textView.replaceCharacters) to avoid CEUndoManager re-entrant assertion crash
  • O(1) keyword lookup via pre-built Set<String> from SQLKeywords.keywords
  • Multi-word keywords (CURRENT ROW, FORCE INDEX, USE INDEX) filtered from the set since word-boundary scanning can't match them

Test plan

  • Enable setting → type select → becomes SELECT
  • Type from , where , join → all uppercase
  • Type inside 'select ' → NOT uppercased
  • Type inside -- select → NOT uppercased
  • Type inside `select` → NOT uppercased
  • Type select_id → NOT uppercased (not a keyword)
  • Type select(SELECT( (parenthesis is a boundary)
  • Paste select from where → NOT uppercased
  • Disable setting → keywords stay as typed
  • Fast typing select * from → no crash

@datlechin datlechin merged commit 266db46 into main Apr 10, 2026
2 checks passed
@datlechin datlechin deleted the feat/auto-uppercase-keywords branch April 10, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Automatically UPPERCASE keywords

1 participant