elisp-tree-sitter icon indicating copy to clipboard operation
elisp-tree-sitter copied to clipboard

Conflict between hideshow and tree-sitter

Open mattiasdrp opened this issue 1 year ago • 1 comments

Whenever I M-x tree-sitter-query-builder I have the following error:

hs-grok-mode-type: tsc-query-builder Mode doesn’t support Hideshow Minor Mode

I tried adding a hook:

(use-package tree-sitter-mode
  :hook
  (tuareg-mode . tree-sitter-mode)
  (tree-sitter-mode . (lambda () (hs-minor-mode -1)))
  )

But the error remains

mattiasdrp avatar Jul 25 '22 10:07 mattiasdrp

I was having this issue too, and then I found in my config that I had hs-minor-mode in my prog-mode-hook. If you check major-mode in the tree-sitter-query-builder buffer, you'll see that it's actually tree-sitter-query-mode, so you need to disable hs-minor-mode in that, not in tree-sitter-mode proper. However, I also tried adding a hook to tree-sitter-query-mode to turn it off, and it's already too late, so you will have to disable hideshow before running tree-sitter-query-builder.

I also couldn't find the source of this error in the tree-sitter code, so I checked hideshow.el, and that is where the issue originates, not in this package.

ntBre avatar Sep 08 '22 13:09 ntBre

Sorry for the delay! Thanks, that actually fixed my issue :-)

mattiasdrp avatar Nov 23 '22 10:11 mattiasdrp

I also couldn't find the source of this error in the tree-sitter code, so I checked hideshow.el, and that is where the issue originates, not in this package.

what the issues hideshow package has? This should be fixed in upstream.

currently workaround:

(use-package hideshow
  :hook (prog-mode . (lambda ()
                       (unless (eq major-mode 'tree-sitter-query-mode)
                         (hs-minor-mode)))))

snowman avatar Jun 16 '23 08:06 snowman

For some reason hs-grok-mode-type throws an error after determining that the mode doesn't support hideshow mode. I didn't originally think of this as an actual issue in hideshow, just an incompatibility. But looking at it again, it doesn't really make sense why they signal an error instead of just disabling hideshow (as they already do) and printing a warning or something. I'm not really using either of these packages anymore, but that should give you somewhere to start if you want to report/fix this upstream.

I think hideshow is part of emacs itself, so this is probably a time for M-x report-emacs-bug.

ntBre avatar Jun 16 '23 13:06 ntBre