Skip to content

What would it take to use my lua grammar :) #543

Description

@tjdevries

Hi @vigoux :)

Just wondering what it would take to switch to this grammar: https://github.com/tjdevries/tree-sitter-nlua

I'd like to iterate on it and use it w/ tree-sitter, but it's pretty hard right now because of the default query appending and not using the same names...

If change the names of my repo would make things easy / you would accept it as the new lua grammar, I could do that. Just wondering what your thoughts are 😄

Activity

  1. theHamsta commented on Sep 30, 2020

    @theHamsta
    Member

    use #506 to install from local paths and generate from grammar or else just push it to your github repo

      require "nvim-treesitter.parsers".get_parser_configs().lisp = {
        install_info = {
          url = "~/projects/tree-sitter-lisp",
          files = {"src/parser.c"}
        }
      }
      --require "nvim-treesitter.parsers".get_parser_configs().viml = {
      --install_info = {
      --url = "https://github.com/vigoux/tree-sitter-viml",
      --files = {"src/parser.c"}
      --}
      --}
      require "nvim-treesitter.parsers".get_parser_configs().markdown = nil
      require "nvim-treesitter.parsers".get_parser_configs().zig = {
        install_info = {
          url = "https://github.com/GrayJack/tree-sitter-zig",
          files = {"src/parser.c"}
        }
      }
      require "nvim-treesitter.parsers".get_parser_configs().kotlin = {
        install_info = {
          url = "https://github.com/QthCN/tree-sitter-kotlin",
          files = {"src/parser.c"}
        }
      }
    

    #506 does you the favor of not deleting the parser repo after compilation which might be advantageous.

    We can also make it the official one or use it as soon it is in some nvim runtime path. You can set the used_by, filetype options that some parsers already use. The query parser is for instance not used on normal scheme files but only on scheme files in subdirectory parser.

  2. tjdevries commented on Nov 22, 2020

    @tjdevries
    ContributorAuthor

    One question I had related to this. Any way to get the query files from the parser repo? I'd like to keep the files there if possible and iterate on them.

  3. vigoux commented on Nov 22, 2020

    @vigoux
    Member

    I think the easiest way would be to symlink them manually... We don't keep the parsers files around (to save some roome on users side).

  4. theHamsta commented on Nov 22, 2020

    @theHamsta
    Member

    @vigoux he wants us to adopt his queries. Just add a custom key to the parser info that we should copy the queries during installation (and add the necessary Lua code for this). Another possibility would be that to download the queries from his repo in the write-lockfile script so that whenever we bump the version of the Lua parser we import his queries.

    Should we provide facilities to install either version of the Lua parser (nvim-treesitter/tree-sitter-lua or tjdevries tree-sitter-nlua)?

  5. theHamsta commented on Nov 22, 2020

    @theHamsta
    Member

    If you make the language of your parser nlua both parsers you even co-exist (or better their queries). A setting could determine whether to load the one or the other.

  6. vigoux commented on Nov 23, 2020

    @vigoux
    Member

    The trees generated by the lua parser and the nlua parser differs by a fair bit, I think having them more close one to the other would be a good selling point (as switching from one to the other would basically be noop).

  7. tjdevries commented on Nov 28, 2020

    @tjdevries
    ContributorAuthor

    I don't want them to be the same. I don't like the structure of the other tree. That's why I rewrote from scratch instead of forking and sending pr. Similar things are not grouped semantically IMO in the other grammar.

  8. clason commented on Jan 17, 2022

    @clason
    Contributor

    Right now we're going with switching to https://github.com/MunifTanjim/nvim-treesitter-lua, which looks to be a better parser for the "pure" language.

    But since your parser is called nlua, there is no obstacle to adding it as an additional parser for people interested in something especially tuned towards Neovim development. (It might be worth investing a bit of thought into how to make it easier to use one or the other parser, depending on filepath?)

    I've added this to the tracking issue so I'm closing this one; but feel free to continue discussing here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions