-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
helix: Support [[grammar]]
in languages.toml
#3911
Conversation
Add support for the `[[grammar]]` key of `languages.toml`: https://docs.helix-editor.com/languages.html#tree-sitter-grammar-configuration
@@ -0,0 +1,12 @@ | |||
[use-grammars] | |||
except = ["yaml", "json"] | |||
[[grammar]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont love that using concatTextFile
gives us this very slightly ugly result without an additional break between sections, unsure if there is a workaround
cc @Philipp-M in case you have any thoughts |
# NB: helix requires that `use-grammars` be the first key in languages.toml if present | ||
# pkgs.formats.toml relies on piping generated json through | ||
# [remarshal](https://github.com/remarshal-project/remarshal), | ||
# so we have to concatenate in order to preserve this ordering |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about that? AFAIK helix uses the serde_derive
implementation for it which should respect the TOML standard, no weird TOML breaking custom deserializer (in the way that it relies on ordered tables/objects).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs say
# Note: this key must come **before** the [[language]] and [[grammar]] sections
but indeed this just means that it should be outside of the language
and grammar
sections, so just regular TOML.
Sorry almost forgot about it. I'm not sure about the PR (see comment in code), I think it's better to just serialize the whole languages.toml. I have implemented this some time back in Philipp-M@8bdd7cc. But it doesn't solve the grammars issue see the discussion in #2871 |
Description
Add support for the
[[grammar]]
key oflanguages.toml
: https://docs.helix-editor.com/languages.html#tree-sitter-grammar-configurationChecklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Added myself as module maintainer. See example.
Added myself and the module files to
.github/CODEOWNERS
.edit: Should fix #2871