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

Remove lower-case requirement for language/grammar #4362

Conversation

kleinweby
Copy link
Contributor

As described in #4346 both language and grammar names are sometimes lower-cased. For grammars this is incompatible with ones using uppercase names. And for languages this can be a bit surprising. (At least I stumbled across helix ignoring my queries because of this).

Note that the syntax part is not strictly necessary to get grammars as described in the issue to work.

Closes #4346

@the-mikedavis
Copy link
Member

One more to remove here:

let language_name = language.language_id.to_ascii_lowercase();

@kleinweby kleinweby force-pushed the remove-lowercase-grammar-requirement branch from 5a06fff to 1956564 Compare October 19, 2022 14:41
@kleinweby
Copy link
Contributor Author

Ah thanks. I've removed the missing to lowercase.

Two of the tests actually used this lowercase conversion. I've simply changed them. I've also checked language.toml that every language/grammar currently used lower-case names, which is the case.

@kleinweby kleinweby force-pushed the remove-lowercase-grammar-requirement branch from 1956564 to 0e029e0 Compare October 20, 2022 07:06
@the-mikedavis
Copy link
Member

I missed this in the review of the PR that added it but there's a real test failure now from the uppercasing on this line:

let language = get_language("Rust").unwrap();
- could you set that to lowercase?

Christian Speich added 2 commits October 21, 2022 08:45
Currently we always lower-case the grammar name when loading it. While it
is somewhat of an convention to name tree-sitter grammars in lowercase
there is no rule to enforce it.

This patch removes the lower-casing to allow all possible grammar names.

Signed-off-by: Christian Speich <[email protected]>
Just like for grammars we currently force a lower-case of the name for
some actions (like filesystem lookup). To make this consistent and less
surprising for users, we remove this lower-casing here.

Note: it is still the preferred way to name both language and grammar in
lower-case

Signed-off-by: Christian Speich <[email protected]>
@kleinweby kleinweby force-pushed the remove-lowercase-grammar-requirement branch from 0e029e0 to 66ccfcc Compare October 21, 2022 06:51
@kleinweby
Copy link
Contributor Author

Sure, I rebased the PR and lowercased the failing test.

@the-mikedavis the-mikedavis merged commit 79ef39a into helix-editor:master Oct 21, 2022
@the-mikedavis
Copy link
Member

Thanks!

@kleinweby kleinweby deleted the remove-lowercase-grammar-requirement branch October 21, 2022 13:12
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.

Inconsistent/undocumented lowercase usage for grammars/languages
2 participants