Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add zig tree-sitter support #631

Merged
merged 3 commits into from
Aug 28, 2021
Merged

Add zig tree-sitter support #631

merged 3 commits into from
Aug 28, 2021

Conversation

voroskoi
Copy link
Contributor

Highlighting works, indenting not so much, but I guess it is more than nothing.
Queries are from https://github.com/Himujjal/tree-sitter-zig

@kirawi
Copy link
Member

kirawi commented Aug 20, 2021

indents.scm and folds.scm are not supported. For indents you'll have to define a indents.toml instead, which looks like this: https://github.com/helix-editor/helix/blob/master/runtime/queries/rust/indents.toml

runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
@voroskoi
Copy link
Contributor Author

Thank You for the heads up, I have cleaned up things a bit. I have switched to a different grammar repo, but nvim-treesitter also use this one, so it is probably more up to date. Still have to figure out the indenting, does not work for me.

Copy link
Member

@kirawi kirawi left a comment

Choose a reason for hiding this comment

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

You're getting there!

runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/zig/injections.scm Outdated Show resolved Hide resolved
runtime/queries/zig/highlights.scm Show resolved Hide resolved
runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
@voroskoi
Copy link
Contributor Author

Ok, I think the highlights part is fine for initial support. Time to figure out the indenting part.

@voroskoi
Copy link
Contributor Author

I have removed the indents.toml as I can not figure out why it does not do anything.

runtime/queries/zig/highlights.scm Outdated Show resolved Hide resolved
@kirawi
Copy link
Member

kirawi commented Aug 22, 2021

It seems like the highlighting is a little incorrect:
Capture

Function calls are being highlighted as variables. It should be ready to merge after that gets corrected. You can also leave (IDENTIFIER) @variable at the end of the highlights.scm so everything else gets highlighted as variables.

@archseer
Copy link
Member

I have removed the indents.toml as I can not figure out why it does not do anything.

Can you show me the file (it's gone from git history)? I might be able to help there.

@archseer
Copy link
Member

Nice work! I'll do some testing on indents but I think it's good for merge 👍

@archseer archseer merged commit f22e0aa into helix-editor:master Aug 28, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants