From 6f5a4f6306e6dfd23f93c8b60493871c9a600cc0 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Mon, 3 Apr 2023 12:46:21 +0800 Subject: feat: use `-bundle` to build parsers on macOS This will make the parsers align more closely to the ones bundled with Neovim, because CMake uses the `-bundle` flag (instead of `-shared`) on macOS when a library is compiled as a `MODULE`. See, for example: https://github.com/neovim/neovim/blob/10baf89712724b4b95f7c641f2012f051737003c/cmake.deps/cmake/TreesitterParserCMakeLists.txt#L6-L9 --- lua/nvim-treesitter/shell_command_selectors.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/nvim-treesitter/shell_command_selectors.lua b/lua/nvim-treesitter/shell_command_selectors.lua index cf99a01d7..de44ffa1c 100644 --- a/lua/nvim-treesitter/shell_command_selectors.lua +++ b/lua/nvim-treesitter/shell_command_selectors.lua @@ -110,9 +110,13 @@ function M.select_compiler_args(repo, compiler) "parser.so", "-I./src", repo.files, - "-shared", "-Os", } + if fn.has "mac" == 1 then + table.insert(args, "-bundle") + else + table.insert(args, "-shared") + end if #vim.tbl_filter(function(file) ---@param file string local ext = vim.fn.fnamemodify(file, ":e") -- cgit v1.2.3-70-g09d2