Skip to content

Improve the user experience with disabled sourcehut grammars #11258

Open
@mxmerz

Description

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?

Metadata

Assignees

No one assigned

    Labels

    A-documentationArea: Documentation improvementsA-language-supportArea: Support for programming/text languagesC-enhancementCategory: Improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions