hlissner / evil-multiedit

Multiple cursors for evil-mode, based on iedit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conflict with tree-sitter-hl-mode in python

lccambiaghi opened this issue · comments

When having tree-sitter-hl-mode active in a python buffer, if I M-d some occurrences are not identified and if I try to edit them some occurrences are not changed but only appended to.

(package! tree-sitter
  :recipe (:host github :repo "ubolonton/emacs-tree-sitter"
           :files ("lisp/*.el")))
(package! tsc :recipe (:host github
            :repo "ubolonton/emacs-tree-sitter"
            :files ("core/*.el")))
(package! tree-sitter-langs
  :recipe (:host github :repo "ubolonton/emacs-tree-sitter"
           :files ("langs/*.el" "langs/queries")))

and

(use-package tree-sitter :after python-mode)

(after! tree-sitter
  (require 'tree-sitter)
  (require 'tree-sitter-langs)
  (require 'tree-sitter-hl))

(add-hook 'python-mode-hook #'tree-sitter-hl-mode)

I posted a stack trace in the tree-sitter repo in case you are interested: emacs-tree-sitter/elisp-tree-sitter#73 (comment)

In the tree-sitter repo they have observed that bumping iedit solves the issue. So I guess closing #39 would also fix the current issue.

FWIW, here is a small hack that temporarily disables tree-sitter-mode when iedit is invoked:

;; hack to fix conflict between pinned iedit/tree-sitter/python-mode
;; related issues:
;; 1. https://github.com/hlissner/evil-multiedit/issues/40
;; 2. https://github.com/ubolonton/emacs-tree-sitter/issues/73#issuecomment-739195967
;; 3. https://github.com/hlissner/evil-multiedit/issues/39
(add-hook! 'tree-sitter-after-on-hook
           (add-hook! 'iedit-mode-hook :local (tree-sitter-mode -1))
           (add-hook! 'iedit-mode-end-hook :local (tree-sitter-mode 1)))

#39 was fixed a short while ago, so I'll assume this has been resolved as well. Let me know if that isn't the case and I'll reopen it. Thanks for bringing it to my attention!