-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(crafted-ide-configure-tree-sitter) currently broken due to issues in treesit-auto #427
Comments
Thank you for reporting the issue. From the user side, this can (temporarily) be fixed using the ;; using seq-remove
(crafted-ide-configure-tree-sitter
(seq-remove (lambda (a)
(member a '(janet markdown latex)))
treesit-auto-langs))
;; using cl
(require 'cl)
(crafted-ide-configure-tree-sitter
(cl-remove-if (lambda (a)
(member a '(janet markdown latex)))
treesit-auto-langs)) Since (customize-set-variable 'treesit-auto-langs
(seq-remove (lambda (a)
(member a '(janet markdown latex)))
treesit-auto-langs))
;; (cl-remove-if version omitted) I'm not entirely sure how we want to go about fixing this inside crafted-emacs. I've looked through the treesit-auto repository, seems like there hasn't been much movement since ~April last year, even though there are multiple PRs open fixing this problem. We could obviously remove them inside Any other ideas @jeffbowman @sthesing ? |
Been busy at work, sorry for the delay. The last commit I see was in May last year when the author of treesit-auto bumped the revision. There are other forks which have more recent updates (notably the fork by gs-101). Short of waiting for the author of treesit-auto to fix things, we could potentially provide our own implementation internally. That is a lot of extra burden on this project to maintain though. Another possible answer is to just remove treesit-auto from |
Thanks for the quick reply.
This gives me:
|
My bad, probably needs to require (require 'treesit-auto)
(crafted-ide-configure-tree-sitter
(seq-remove (lambda (a)
(member a '(janet markdown latex)))
treesit-auto-langs)) A more "complete" version may also give appropriate error: (if (require 'treesit-auto nil :noerror)
(crafted-ide-configure-tree-sitter
(seq-remove (lambda (a)
(member a '(janet markdown latex)))
treesit-auto-langs))
(warn "treesit-auto not available")) We also normally check if Emacs is compiled with treesitter support (see the full implementation, although this is unrelated to your issue, just for completeness 😄). |
I've been thinking about this for a couple of days... one of the reasons we provide the (crafted-ide-configure-tree-sitter '(go java javascript typescript)) Using built-in facilities, it may be possible to do something like this (see below) for (dolist (grammar '((tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" "v0.23.2" "tsx/src"))
(typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" "v0.23.2" "typescript/src"))))
(unless (alist-get (car grammar) treesit-language-source-alist)
(add-to-list 'treesit-language-source-alist grammar))
(unless (treesit-language-available-p (car grammar))
(treesit-install-language-grammar (car grammar)))
(dolist (mapping '((typescript-mode . typescript-ts-base-mode)
(js-mode . typescript-ts-base-mode)
(js2-mode . typescript-ts-base-mode)))
(unless (alist-get (car mapping) major-mode-remap-alist)
(add-to-list 'major-mode-remap-alist mapping)))) obviously, change the grammar urls appropriately as well as the mode mapping. |
So is this something we need to address in code? Or in documentation? |
The problem is outside Crafted Emacs. The code presented here is a work-around to try to help those who might run into the problem. Unless we come up with our own hand-rolled auto installer for treesitter grammars, this isn't really a Crafted Emacs specific problem. |
Sorry Jeff, I phrased the question poorly. What I mean is:
Now, you already answered question No 2. Thanks for that. But what do you folks think? Is this something that should go into the docs? Or is this issue enough? Or do we need to add more general explanation to the documentation? |
I'm happy enough to just leave it here in the comments. We may think about adding something related to this in a general sense. Along the lines of: we appreciate when people report issues with packages we include in our configuration, and we will try to help as much as possible, but for issues outside of Crafted Emacs, we will defer to the users best judgement on managing their own configuration. Anything that can be directly attributed to code we wrote we will do our best to resolve. Does that make sense? Maybe it belongs in the contributing section. Happy to have more discussion on this. |
Operating System
Linux/BSD
Additional Operating System information
No response
Emacs Version
29
Emacs Configuration Details
Anything else that may be related to the issue you're having?
No response
What happened?
Enabling
(crafted-ide-configure-tree-sitter)
should install all "default" tree-sitter grammars viatreesit-auto
.Due to changes in packaging (
latex
), mistake in naming (janet
) or changes in directory layout (markdown
) this leads to a repeated warning on Emacs startup. See renzmann/treesit-auto#116 for the upstream issue and the referenced issues accordingly.What should have happened?
The grammars should install properly.
The text was updated successfully, but these errors were encountered: