mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
feat(ruby): add treesit support
This commit is contained in:
@ -22,9 +22,6 @@
|
|||||||
(when (modulep! +lsp)
|
(when (modulep! +lsp)
|
||||||
(add-hook 'ruby-mode-local-vars-hook #'lsp! 'append))
|
(add-hook 'ruby-mode-local-vars-hook #'lsp! 'append))
|
||||||
|
|
||||||
(when (modulep! +tree-sitter)
|
|
||||||
(add-hook 'ruby-mode-local-vars-hook #'tree-sitter! 'append))
|
|
||||||
|
|
||||||
(after! inf-ruby
|
(after! inf-ruby
|
||||||
(add-hook 'inf-ruby-mode-hook #'doom-mark-buffer-as-real-h)
|
(add-hook 'inf-ruby-mode-hook #'doom-mark-buffer-as-real-h)
|
||||||
;; switch to inf-ruby from compile if we detect a breakpoint has been hit
|
;; switch to inf-ruby from compile if we detect a breakpoint has been hit
|
||||||
@ -39,6 +36,20 @@
|
|||||||
"{" #'ruby-toggle-block))
|
"{" #'ruby-toggle-block))
|
||||||
|
|
||||||
|
|
||||||
|
(use-package! ruby-ts-mode
|
||||||
|
:when (modulep! +tree-sitter)
|
||||||
|
:when (fboundp 'ruby-ts-mode) ; 29.1+ only
|
||||||
|
:defer t
|
||||||
|
:init
|
||||||
|
(set-tree-sitter! 'ruby-mode 'ruby-ts-mode
|
||||||
|
'((ruby :url "https://github.com/tree-sitter/tree-sitter-ruby")))
|
||||||
|
:config
|
||||||
|
(set-electric! 'ruby-ts-mode :words '("else" "end" "elsif"))
|
||||||
|
(set-repl-handler! 'ruby-ts-mode #'inf-ruby)
|
||||||
|
(when (modulep! +lsp)
|
||||||
|
(add-hook 'ruby-ts-mode-local-vars-hook #'lsp! 'append)))
|
||||||
|
|
||||||
|
|
||||||
(use-package! yard-mode
|
(use-package! yard-mode
|
||||||
:hook ruby-mode)
|
:hook ruby-mode)
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
(modulep! :tools tree-sitter))
|
(modulep! :tools tree-sitter))
|
||||||
"This module requires (:tools tree-sitter)")
|
"This module requires (:tools tree-sitter)")
|
||||||
|
|
||||||
|
(assert! (or (not (modulep! +tree-sitter))
|
||||||
|
(fboundp 'ruby-ts-mode))
|
||||||
|
"Can't find `ruby-ts-mode'; Emacs 29.1+ is required")
|
||||||
|
|
||||||
(unless (executable-find "ruby")
|
(unless (executable-find "ruby")
|
||||||
(warn! "Ruby isn't installed."))
|
(warn! "Ruby isn't installed."))
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
(perl "https://github.com/ganezdragon/tree-sitter-perl" nil nil nil nil)
|
(perl "https://github.com/ganezdragon/tree-sitter-perl" nil nil nil nil)
|
||||||
(proto "https://github.com/mitchellh/tree-sitter-proto" nil nil nil nil)
|
(proto "https://github.com/mitchellh/tree-sitter-proto" nil nil nil nil)
|
||||||
(r "https://github.com/r-lib/tree-sitter-r" nil nil nil nil)
|
(r "https://github.com/r-lib/tree-sitter-r" nil nil nil nil)
|
||||||
(ruby "https://github.com/tree-sitter/tree-sitter-ruby" nil nil nil nil)
|
|
||||||
(rust "https://github.com/tree-sitter/tree-sitter-rust" nil nil nil nil)
|
(rust "https://github.com/tree-sitter/tree-sitter-rust" nil nil nil nil)
|
||||||
(scala "https://github.com/tree-sitter/tree-sitter-scala" nil nil nil nil)
|
(scala "https://github.com/tree-sitter/tree-sitter-scala" nil nil nil nil)
|
||||||
(sql "https://github.com/DerekStride/tree-sitter-sql" "gh-pages" nil nil nil)
|
(sql "https://github.com/DerekStride/tree-sitter-sql" "gh-pages" nil nil nil)
|
||||||
|
Reference in New Issue
Block a user