ganezdragon / tree-sitter-perl

a perl parser for javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inclusion into nvim-treesitter

lcrownover opened this issue · comments

Hey @ganezdragon ,

Do you know when you might PR this into the main nvim-treesitter repo? Would be cool to have perl support out of the box instead of having to clone and build and configure manually.

lua/nvim-treesitter/parsers.lua

@lcrownover , I haven't used neovim so far, so haven't ported it for that. But let me spend some time over the weekend for this and try to build it.

Awesome!

I was able to get it working by generating the files per your instructions, then using this config:

local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.perl = {
    install_info = {
        url = "~/repos/tree-sitter-perl",
        files = {"src/parser.c","src/scanner.cc"},
    },
    used_by = {"pl","pm","t"},
}

So I think you'd just need an entry like:

list.perl = {
  install_info = {
    url = "https://github.com/ganezdragon/tree-sitter-perl",
    files = { "src/parser.c", "src/scanner.cc" },
  },
  maintainers = { "@ganezdragon" },
}

As well as pre-generating and committing the src files.

I'll play around with it today and see if I can get it working.

@lcrownover , oh that would be great! Do let me know.

This was actually super easy. I'm happy to open a PR against my fork for you on the nvim-treesitter repo if you'd like, otherwise the only change that is needed is adding:

list.perl = {
  install_info = {
    url = "https://github.com/ganezdragon/tree-sitter-perl",
    files = { "src/parser.c", "src/scanner.cc" },
    generate_requires_npm = true,
  },
  maintainers = { "@ganezdragon" },
}

to nvim-treesitter/lua/nvim-treesitter/parsers.lua.

You don't even have to pre-generate the source files, the build process takes care of that.

ohh this looks cool. Yea please go ahead and open a PR and please feel free to copy me there.

Hi, I am also using this with My neovim on trial. I added my highlight .scm here -> https://github.com/lcrownover/nvim-treesitter/pull/1