diff --git a/install.sh b/install.sh index 0d899cf..4e93696 100755 --- a/install.sh +++ b/install.sh @@ -737,6 +737,17 @@ function start_neovim_background_setup() { echo "⚠️ Lazy sync failed with exit code $lazy_exit_code" >> $neovim_log fi + # Compile TreeSitter parsers (poll until all are loadable, then exit) + echo "Compiling TreeSitter parsers..." >> $neovim_log + timeout 180 nvim --headless +"lua local p=require('config.treesitter-parsers'); vim.wait(170000, function() for _,l in ipairs(p) do if not pcall(vim.treesitter.language.inspect,l) then return false end end; return true end, 2000); vim.cmd('qa!')" >> $neovim_log 2>&1 + ts_exit_code=$? + + if [ $ts_exit_code -eq 0 ]; then + echo "✅ TreeSitter parsers compiled successfully" >> $neovim_log + else + echo "⚠️ TreeSitter parser compilation may not have completed (exit code $ts_exit_code)" >> $neovim_log + fi + echo "Installing Mason tools in Neovim..." >> $neovim_log nvim --headless "+MasonToolsInstallSync" +qa >> $neovim_log 2>&1 mason_exit_code=$? diff --git a/nvim/lua/config/treesitter-parsers.lua b/nvim/lua/config/treesitter-parsers.lua new file mode 100644 index 0000000..652a2ac --- /dev/null +++ b/nvim/lua/config/treesitter-parsers.lua @@ -0,0 +1,53 @@ +return { + "bash", + "c", + "cpp", + "css", + "csv", + "diff", + "dockerfile", + "elixir", + "erlang", + "fish", + "git_config", + "git_rebase", + "gitattributes", + "gitcommit", + "gitignore", + "go", + "gomod", + "gosum", + "gowork", + "gotmpl", + "graphql", + "haskell", + "html", + "javascript", + "jq", + "jsdoc", + "json", + "latex", + "lua", + "luadoc", + "markdown", + "markdown_inline", + "python", + "regex", + "ruby", + "rust", + "scss", + "sql", + "ssh_config", + "supercollider", + "svelte", + "tmux", + "toml", + "tsx", + "typescript", + "typst", + "vim", + "vimdoc", + "vue", + "yaml", + "zig", +} diff --git a/nvim/lua/plugins/nvim-treesitter.lua b/nvim/lua/plugins/nvim-treesitter.lua index a51a158..ff270d8 100644 --- a/nvim/lua/plugins/nvim-treesitter.lua +++ b/nvim/lua/plugins/nvim-treesitter.lua @@ -7,61 +7,6 @@ return { }, config = function() require("nvim-treesitter").setup() - - local ensure_installed = { - "bash", - "c", - "cpp", - "css", - "csv", - "diff", - "dockerfile", - "elixir", - "erlang", - "fish", - "git_config", - "git_rebase", - "gitattributes", - "gitcommit", - "gitignore", - "go", - "gomod", - "gosum", - "gowork", - "gotmpl", - "graphql", - "haskell", - "html", - "javascript", - "jq", - "jsdoc", - "json", - "latex", - "lua", - "luadoc", - "markdown", - "markdown_inline", - "python", - "regex", - "ruby", - "rust", - "scss", - "sql", - "ssh_config", - "supercollider", - "svelte", - "tmux", - "toml", - "tsx", - "typescript", - "typst", - "vim", - "vimdoc", - "vue", - "yaml", - "zig", - } - - require("nvim-treesitter").install(ensure_installed) + require("nvim-treesitter").install(require("config.treesitter-parsers")) end, }