Skip to content
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

Add ability to auto-install language grammars #8

Merged
merged 5 commits into from
Jan 31, 2023
Merged

Add ability to auto-install language grammars #8

merged 5 commits into from
Jan 31, 2023

Conversation

justinbarclay
Copy link
Contributor

As a follow-up to #7, I've opened up this PR of my work so far for auto-installing grammars based on users' preferences.

To get this to work easily, I expanded treesit-auto to a global minor mode.

This works pretty well for me, as is, but if you want this PR, I am happy to keep tweaking it as you feel necessary 🙂

Copy link
Owner

@renzmann renzmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for getting this started! I think this will be great functionality to have. Now that we're on MELPA I want to make sure we stick to their guidelines as much as possible. I have three small warnings currently:

⛔ Warning (comp): treesit-auto.el:162:16: Warning: variable `_success' not left unused  
⛔ Warning (comp): treesit-auto.el:161:16: Warning: variable `_grammar-missing' not left unused  
⛔ Warning (comp): treesit-auto.el:183:20: Warning: defcustom for `treesit-auto-minor-mode' fails to specify containing group  

I'll have a chance to look/test more thoroughly this afternoon

@justinbarclay
Copy link
Contributor Author

Thanks so much for getting this started! I think this will be great functionality to have. Now that we're on MELPA I want to make sure we stick to their guidelines as much as possible. I have three small warnings currently:

⛔ Warning (comp): treesit-auto.el:162:16: Warning: variable `_success' not left unused  
⛔ Warning (comp): treesit-auto.el:161:16: Warning: variable `_grammar-missing' not left unused  
⛔ Warning (comp): treesit-auto.el:183:20: Warning: defcustom for `treesit-auto-minor-mode' fails to specify containing group  

I'll have a chance to look/test more thoroughly this afternoon

Cool, good to know that you're using Melpa standard to lint things. These should be addressed now.

justinbarclay and others added 2 commits January 30, 2023 19:36
Co-authored-by: Robb Enzmann <32076780+renzmann@users.noreply.github.com>
Copy link
Owner

@renzmann renzmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the config I've used to test it:

  (use-package treesit-auto
    :load-path "~/repos/treesit-auto/"
    :demand t
    :config
    (add-to-list 'treesit-auto-fallback-alist '(bash-ts-mode . sh-mode))
    (advice-add 'treesit-install-language-grammar
		:after (lambda (&rest _r) (treesit-auto-apply-remap)))
    (setq treesit-auto-install 'prompt)
    (global-treesit-auto-mode))

It's working great for me. Thanks for contributing!

@renzmann renzmann merged commit 708c369 into renzmann:main Jan 31, 2023
@justinbarclay
Copy link
Contributor Author

Awesome! Thanks for merging this in. 💖

This package is now exactly what I feel the treesit system was missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants