Closed colonelpanic8 closed 1 year ago
I wrote this code in my config to do this:
(defun treesit-auto-for-each (fn) (cl-loop for recipe in treesit-auto-recipe-list do (let ((from (treesit-auto-recipe-remap recipe)) (to (treesit-auto-recipe-ts-mode recipe))) (funcall fn from to)))) (defun treesit-auto-get-mode-hook-symbol (mode) (intern (concat (symbol-name mode) "-hook"))) (defvar treesit-auto-run-original-hooks t) (defvar treesit-auto-hook-copy-blacklist '((rust-mode . rust-ts-mode))) (treesit-auto-for-each (lambda (from to) (let ((targets (if (listp from) from (list from)))) (cl-loop for from in targets do (letrec ((to-hook (treesit-auto-get-mode-hook-symbol to)) (from-hook (treesit-auto-get-mode-hook-symbol from)) (treesit-auto-hook-name (intern (concat "treesit-auto-run-" (symbol-name from-hook) "-for-" (symbol-name to))))) (defalias treesit-auto-hook-name `(lambda () (when (and treesit-auto-run-original-hooks (boundp ',from-hook) (not (memq '(,from . ,to) treesit-auto-hook-copy-blacklist))) (message "Running hooks from %s for %s" ',from-hook ',to) (apply 'run-hooks ,from-hook)))) (add-hook to-hook treesit-auto-hook-name))))))
I'd be happy to clean this up if it could be something that would make sense to include as part of the package.
nevermind, seems that updating lsp-mode fixed this issue for me
I think you might have meant to close https://github.com/renzmann/treesit-auto/issues/51 instead of this issue.
I wrote this code in my config to do this:
I'd be happy to clean this up if it could be something that would make sense to include as part of the package.