Emacs SQL Tree-Sitter mode, sql-ts-mode
- Syntax Highlight Parser-based Font Lock
- Indentation Parser-based Indentation
require
- emacs-version >= 29.1
install by straight
(straight-use-package
'(sql-ts-mode :type git :host github :repo "kingrongH/sql-ts-mode"))
;; or integrated with use-pakage
(use-package sql-ts-mode
:straight '(sql-ts-mode :type git :host github :repo "kingrongH/sql-ts-mode"))- auto enable
*.sql(setq auto-mode-alist (append '(("\\.sql\\'" . sql-ts-mode)) auto-mode-alist))
- enable by hand
M-x sql-ts-mode RET
The current sql-ts-mode in this repository offers basic functionality for indentation and syntax highlighting. While I’ve been using it weekly for SQL editing, there’s still room for improvement.
Some todos list here
- [ ] more indentation support, eg. create statement
- [ ] integrated with treesit-fold, support fold for select, from, case etc.
- [ ] add key map for tab cycling between fold and indentation
- treesitter SQL grammar: DerekStride/tree-sitter-sql