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

Add support for go.mod files #42

Closed
wants to merge 1 commit into from

Conversation

camdencheek
Copy link

@camdencheek camdencheek commented Apr 5, 2021

This commit adds a grammar for go.mod files using the definition found
at https://golang.org/ref/mod#go-mod-file-grammar.

I did my best to imitate the multi-grammar repos for typescript and ocaml, but I may have missed some things.

I've been using this through nvim-treesitter (screenshot below), so I haven't exercised the other bindings.

Screen Shot 2021-04-05 at 16 16 08

This commit adds a grammar for go.mod files using the definition found
at https://golang.org/ref/mod#go-mod-file-grammar.
@maxbrunsfeld
Copy link
Contributor

This is great work @camdencheek. I actually think that the mult-grammar repository structure of tree-sitter-typescript and tree-sitter-ocaml is a bit cumbersome, and it's only worthwhile to me because those grammars share some common code. For example, in TypeScript, the typescript and tsx grammars share some common grammar code, queries, and tests.

In this case, since go.mod and Go are two completely different languages, and some users may only care about Go, but not go.mod, I would prefer to just keep the go.mod grammar in its own repository. What do you think about that?

@camdencheek
Copy link
Author

Seems reasonable to me! I'll go ahead and pull it out into a separate repo.

What are your thoughts on this being a personal repo vs under the tree-sitter org? I don't see anything in the contribution guide about contributing new grammars. I'm happy to maintain it either way.

@camdencheek
Copy link
Author

Closing in favor of implementing the go.mod grammar in a separate repo. New repo is at https://github.com/camdencheek/tree-sitter-go-mod

@maxbrunsfeld
Copy link
Contributor

Yeah, I think a personal repo is best. Do you want to open a PR on tree-sitter/tree-sitter that adds a link to your grammar in the docs (here)?

@camdencheek
Copy link
Author

Done 👍

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.

2 participants