Files
lua-nvim/lua/cargdev/plugins/treesitter.lua
Carlos Gutierrez c1cddfdf68 feat: Major performance optimization and LSP stability improvements
- Add comprehensive file type filtering to prevent LSP errors on non-text files
- Fix image freezing issues during file searches in Telescope
- Optimize leader key response time (500ms → 200ms)
- Add performance monitoring tools and LSP health checks
- Implement safe file search commands to prevent crashes
- Add startup optimization and deferred heavy operations
- Enhance LSP error handling with timeouts and graceful fallbacks
- Optimize Treesitter, completion, and search performance
- Add comprehensive troubleshooting guide for LSP issues

Performance improvements:
- Faster scrolling and UI responsiveness
- Better memory management and startup times
- Reduced diagnostic updates and LSP overhead
- Automatic exclusion of problematic file types

New keymaps:
- <leader>pp - Performance monitoring
- <leader>pl - LSP health check
- <leader>pr - Restart LSP
- <leader>ff - Safe file search (prevents LSP errors)
- <leader>ft - Text files only search
2025-08-12 02:21:05 -04:00

74 lines
1.9 KiB
Lua

return {
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPost", "BufNewFile" }, -- Changed from BufReadPre to BufReadPost for better performance
build = ":TSUpdate",
dependencies = {
"windwp/nvim-ts-autotag",
},
config = function()
-- import nvim-treesitter plugin
local treesitter = require("nvim-treesitter.configs")
-- configure treesitter
treesitter.setup({ -- enable syntax highlighting
highlight = {
enable = true,
disable = function(lang, buf)
-- Prevent Treesitter from parsing Copilot files
return lang == "copilot" or vim.api.nvim_buf_get_name(buf):match("copilot.lua")
end,
-- Performance optimizations
use_languagetree = true,
additional_vim_regex_highlighting = false,
},
-- enable indentation
indent = { enable = true },
-- enable autotagging (w/ nvim-ts-autotag plugin)
autotag = {
enable = true,
},
-- ensure these language parsers are installed
ensure_installed = {
"json",
"javascript",
"typescript",
"java",
"tsx",
"yaml",
"html",
"css",
"prisma",
"markdown",
"markdown_inline",
"svelte",
"graphql",
"sql",
"bash",
"lua",
"vim",
"dockerfile",
"gitignore",
"query",
"vimdoc",
"c",
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
-- Performance optimizations
playground = {
enable = false, -- Disable playground for better performance
},
query_linter = {
enable = false, -- Disable query linter for better performance
},
})
end,
}