Skip to content

Commit

Permalink
Rustic with treesit and nice overlays keymap
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiasdrp committed May 26, 2024
1 parent ac4f7e7 commit 581ca59
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 17 deletions.
15 changes: 13 additions & 2 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -1959,6 +1959,10 @@ have one rule for each file type."
:defer t
:init
(define-prefix-command 'mdrp-fly-map nil "Fly-")
(defvar-keymap mdrp-flycheck-overlay-map
:doc "Keymap attached to lsp and flycheck overlays."
"M-$" #'lsp-execute-code-action)
(fset 'mdrp-flycheck-overlay-map mdrp-flycheck-overlay-map)
:hook ((prog-mode markdown-mode git-commit-mode text-mode) . flycheck-mode)
:general
(:keymaps 'mdrp-fly-map
Expand All @@ -1971,6 +1975,12 @@ have one rule for each file type."
(if (flycheck-next-error-pos n reset)
(list n reset)
(list n t)))
(let ((overlays `(flycheck-info-overlay
flycheck-error-overlay
flycheck-warning-overlay
lsp-flycheck-warning-unnecessary-category)))
(dolist (overlay overlays)
(put overlay 'keymap mdrp-flycheck-overlay-map)))
(message "`flycheck' loaded"))

(use-package flycheck-correct
Expand Down Expand Up @@ -3150,15 +3160,16 @@ DIR and GIVEN-INITIAL match the method signature of `consult-wrapper'."
:config (message "`tree-sitter-langs' loaded"))

(use-package tree-sitter
:demand t
:defer t
:hook
(tuareg-mode . tree-sitter-mode)
(tree-sitter-after-on . tree-sitter-hl-mode)
:config
;; This makes every node a link to a section of code
(setq tree-sitter-debug-jump-buttons t)
;; and this highlights the entire sub tree in your code
(setq tree-sitter-debug-highlight-jump-region t)
(global-tree-sitter-mode)
;; (global-tree-sitter-mode)
:config (message "`tree-sitter' loaded"))

(use-package ts-fold
Expand Down
41 changes: 26 additions & 15 deletions init.org
Original file line number Diff line number Diff line change
Expand Up @@ -3179,6 +3179,10 @@ On the fly syntax checking. One of the greatest package there is for making prog
:defer t
:init
(define-prefix-command 'mdrp-fly-map nil "Fly-")
(defvar-keymap mdrp-flycheck-overlay-map
:doc "Keymap attached to lsp and flycheck overlays."
"M-$" #'lsp-execute-code-action)
(fset 'mdrp-flycheck-overlay-map mdrp-flycheck-overlay-map)
:hook ((prog-mode markdown-mode git-commit-mode text-mode) . flycheck-mode)
:general
(:keymaps 'mdrp-fly-map
Expand All @@ -3191,6 +3195,12 @@ On the fly syntax checking. One of the greatest package there is for making prog
(if (flycheck-next-error-pos n reset)
(list n reset)
(list n t)))
(let ((overlays `(flycheck-info-overlay
flycheck-error-overlay
flycheck-warning-overlay
lsp-flycheck-warning-unnecessary-category)))
(dolist (overlay overlays)
(put overlay 'keymap mdrp-flycheck-overlay-map)))
(message "`flycheck' loaded"))
#+end_src

Expand Down Expand Up @@ -4821,22 +4831,23 @@ Minor mode that uses tree-sitter, an incremental parsing library. As well as LSP
:END:

#+begin_src emacs-lisp
;; This package needs to be loaded to use language parsers
(use-package tree-sitter-langs
:defer t
:config (message "`tree-sitter-langs' loaded"))
;; This package needs to be loaded to use language parsers
(use-package tree-sitter-langs
:defer t
:config (message "`tree-sitter-langs' loaded"))

(use-package tree-sitter
:demand t
:hook
(tree-sitter-after-on . tree-sitter-hl-mode)
:config
;; This makes every node a link to a section of code
(setq tree-sitter-debug-jump-buttons t)
;; and this highlights the entire sub tree in your code
(setq tree-sitter-debug-highlight-jump-region t)
(global-tree-sitter-mode)
:config (message "`tree-sitter' loaded"))
(use-package tree-sitter
:defer t
:hook
(tuareg-mode . tree-sitter-mode)
(tree-sitter-after-on . tree-sitter-hl-mode)
:config
;; This makes every node a link to a section of code
(setq tree-sitter-debug-jump-buttons t)
;; and this highlights the entire sub tree in your code
(setq tree-sitter-debug-highlight-jump-region t)
;; (global-tree-sitter-mode)
:config (message "`tree-sitter' loaded"))
#+end_src

*** Tree sitter folding
Expand Down

0 comments on commit 581ca59

Please sign in to comment.