tree-sitter-julia icon indicating copy to clipboard operation
tree-sitter-julia copied to clipboard

Contributing

Open colinxs opened this issue 4 years ago • 3 comments

I recently learned of tree-sitter through nvim-treesitter and needless to say, I'm pretty excited for Julia support. That being said, are you looking for contributors? If so, what's the current status of tree-sitter-julia and what's the best way to help?

colinxs avatar Aug 11 '20 06:08 colinxs

Yes, contributions are definitely welcome! Some suggestions:

  • Check out the docs on developing parsers with Tree-sitter.

  • This repo has a script, which runs as part of CI, that clones and parses four of the most popular Julia repositories on GitHub.

  • There is also a list of files from these repositories that currently cause one or more parse errors. Currently, there are lot of files in this list, because tree-sitter-julia only parses about 60% of the files in these popular repos without error.

  • You can find problems with the parser by picking a file from this list and parsing it individually with

    tree-sitter parse whichever/file.jl
    
  • Once you've figured out which syntactic construct is causing the error, you can add a unit test for that syntax in the corpus directory. Then you can edit the [https://github.com/tree-sitter/tree-sitter-julia/blob/master/grammar.js] and regenerate the parser with tree-sitter generate, until you are able to make the test pass.

  • After making a fix, you may want to run the update-known-failures script, to see if some files which were previously causing parse errors are now parsing successfully.

maxbrunsfeld avatar Aug 11 '20 16:08 maxbrunsfeld

Sorry for the long overdue reply @maxbrunsfeld ! Life got in the way as it sometimes does.

I still hope to contribute in my spare time, but perhaps it would be helpful to others to add your reply to the README? I know a large chunk of Julia developers use Neovim and the current syntax highlighting leaves a lot to be desired. Maybe that will help attract contributors.

Somewhat related, but I ran across these these scm files in the Julia repo that are used by it's parser. Might any of that be helpful for tree-sitter?

colinxs avatar Feb 01 '21 21:02 colinxs

Yup, those files are useful to some degree, although Tree-sitter works differently than Julia's hand-written parser, so they are generally just useful for finding out what is allowed in Julia. Things often need to be structured a bit differently in the Tree-sitter grammar.

maxbrunsfeld avatar Feb 01 '21 22:02 maxbrunsfeld

Hey @colinxs,

I'm closing this issue since the grammar is mostly complete now.

There's still a few changes that could be made, so feel free to contribute in the future. Either Max or me will review the PR.

Most of the improvements here were made in parallel with changes to nvim-treesitter, so Julia syntax highlighting is probably much better now!

savq avatar Dec 26 '22 23:12 savq