Neovim: build and distribute parsers #3611
Replies: 5 comments 23 replies
-
I did notice that we don't bundle the C parser, which seems to be the only bundled parser in the latest nightly build at the time of writing. No one seems to have missed them up until now. I have the C, Lua, and Vim parsers installed via nvim-treesitter so I guess I wouldn't have noticed needing to bundle them either. I'm not opposed to bundling them or shipping them as separate formulae and adding them as |
Beta Was this translation helpful? Give feedback.
-
Yes, they were not used by Neovim core. That has changed now. (The goal is to support treesitter highlighting without requiring an external plugin.) (I'm not complaining about the old status quo; just interested in getting the homebrew build up to current spec.) |
Beta Was this translation helpful? Give feedback.
-
I've opened Homebrew/homebrew-core#109966 to throw a warning about the not-included parsers for |
Beta Was this translation helpful? Give feedback.
-
How do other distros handle the distribution of parsers? If they're all doing similar things, it may make sense to just follow them, so thinking about downstream isn't too complicated for Neovim. |
Beta Was this translation helpful? Give feedback.
-
As a point of rare agreement between vim and emacs users, it would also be nice for homebrew's emacs formula and cask if the tree-sitter parsers were packaged for homebrew. Emacs does have a command to install the libraries but it requires several manual steps or at the very least some copy-pasting from the internet and trusting it works. Would the homebrew team be open to the idea of including the parsers with the resource "tree-sitter-c" do
url "https://github.com/tree-sitter/tree-sitter-c.git", tag: "v0.20.8"
revision: "b125bec9b331722e4eaab6e02e1fe5b14eefd967"
end followed by a section in resources.each do |r|
libname = "lib#{r.name}.dylib"
r.stage do
cd "src" do
system ENV.cc, "-fPIC", "-c", "-I.", "parser.c"
system ENV.cc, "-fPIC", "-c", "-I.", "scanner.c"
system ENV.cc, "-fPIC", "-shared", "*.o", "-o", libname
lib.install libname
end
end
end |
Beta Was this translation helpful? Give feedback.
-
It seems like Homebrew previously did not build and distribute the C parser as part of the installation. However, since neovim/neovim#15391, tree-sitter-parsers (C, Lua, Viml) are now a mandatory part of the Neovim distribution, which means that
--HEAD
(and 0.8 when that releases in a few weeks) has to be considered broken.The default build installs these in
/usr/local/lib/nvim/parsers
, although they will be found anywhere inruntimepath
(including/usr/local/share/nvim/runtime/parsers
). But since ordering matters, it would be unfortunate if homebrew diverged from the canonical location.Note that we will possibly add more parsers during the 0.9 release cycle, so it would be better not to hard-code specific parsers. Also, while we endeavor to stick to tagged versions for releases, we may use pre-release commits for nightly and ship corresponding queries in runtime (which may be incompatible with releases).
@carlocab
Beta Was this translation helpful? Give feedback.
All reactions