This package provides a major-mode for jq using the tree-sitter grammar for Jq from tree-sitter-jq.
Features:
- indentation
- font-locking
- imenu
- structural navigation with treesitter objects
For a major-mode without tree-sitter see jq-mode.
Emacs 29.1 or above with tree-sitter support is required.
Tree-sitter starter guide: https://git.savannah.gnu.org/cgit/emacs.git/tree/admin/notes/tree-sitter/starter-guide?h=emacs-29
Add the source to treesit-language-source-alist
.
(add-to-list
'treesit-language-source-alist
'(jq "https://github.com/nverno/tree-sitter-jq"))
Then run M-x treesit-install-language-grammar
and select jq
to install the
shared library.
M-x package-install jq-ts-mode
- Clone this repository
- Add the following to your emacs config
(require "[cloned nverno/jq-ts-mode]/jq-ts-mode.el")
If you get the following warning:
⛔ Warning (treesit): Cannot activate tree-sitter, because tree-sitter
library is not compiled with Emacs [2 times]
Then you do not have tree-sitter support for your emacs installation.
If you get the following warnings:
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for jq is unavailable (not-found): (libtree-sitter-jq libtree-sitter-jq.so) No such file or directory
then the jq grammar file is not properly installed on your system.