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

Improve the user experience with disabled sourcehut grammars #11258

Open
mxmerz opened this issue Jul 21, 2024 · 1 comment
Open

Improve the user experience with disabled sourcehut grammars #11258

mxmerz opened this issue Jul 21, 2024 · 1 comment
Labels
A-documentation Area: Documentation improvements A-language-support Area: Support for programming/text languages C-enhancement Category: Improvements

Comments

@mxmerz
Copy link

mxmerz commented Jul 21, 2024

Helix has tree-sitter grammars for languages hare, wren, and gemini, but they are disabled by default in languages.toml, because of unreliability issues with their repositories (see #9316):

use-grammars = { except = [ "hare", "wren", "gemini" ] }

I was not getting syntax highlighting for hare files and it took me quite a while to discover that this was the reason.

I would propose the following changes to make this fact easier to discover:

  • Fix the corresponding documentation of the use-grammars config key, because that currently says "When omitted, all grammars are fetched and built".
    I would replace this with some note along the lines of "The default configuration disables the languages hare, wren, and gemini because of a larger reliability and trust problem with the grammar repositories."

  • In the pull request that made the change, the reasoning included the argument that “it is not hard to reenable them”. When I tried to do that in my user config, I noticed that apparently,

    use-grammars = { except = [] }

    was not sufficient to re-enable all languages, as the exception list of the user config gets appended to the default config's list (it doesn't replace the default config's list).
    Instead, it is necessary (?) to configure either an only list with all languages, or configure

    use-grammars = { only = ["hare", "wren", "gemini"] }

    and then run hx --grammar fetch && hx --grammar build to build these three languages, and then you can comment that line again to re-enable all other grammars.

    I would suggest some possibility of overwriting the use-grammars default config, without having to explicitly specify all languages. Or maybe this is already possible?

  • It would also be great if helix --health and helix --grammar would report disabled grammars to the user in some way.
    I was really confused because helix --health told me my language had highlight queries, even if nothing was highlighted.

I could try to prepare pull requests if you would support these changes?

@mxmerz mxmerz added the C-enhancement Category: Improvements label Jul 21, 2024
@the-mikedavis
Copy link
Member

Oh hmm I guess the merging behavior for config doesn't work well with use-grammars. I wonder if we can explicitly prefer that key from whichever config is loaded last if it is present instead so it works as expected/documented. Documenting that we have exceptions to the grammars we include by default sounds good to me. I'm not sure about including a warning in --health since completions use hx --health languages to determine which list of languages to show and adding rows to the output will mess up its output. Adding it to --grammar sounds good though.

In the long run we'd eventually like to not include many more grammars by default and instead make it possible to install them interactively. That feature needs a lot of design though

@the-mikedavis the-mikedavis added A-documentation Area: Documentation improvements A-language-support Area: Support for programming/text languages labels Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documentation Area: Documentation improvements A-language-support Area: Support for programming/text languages C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

2 participants