-- treesitter.lua: Enables syntax highlighting, code folding, and structural analysis.

return {
  'nvim-treesitter/nvim-treesitter',
  version = false, -- always pull latest
  build = ':TSUpdate',
  ---@type TSConfig
  opts = {
    modules = {
      highlight = { enable = true },
      indent    = { enable = true },
    },
    -- Parsers that should always be present
    ensure_installed = {
      'bash', 'html', 'java', 'latex', 'lua', 'markdown', 'markdown_inline',
      'python', 'r', 'sql', 'vim', 'yaml',
    },
    sync_install = false, -- install in background
    auto_install = true,  -- fetch parser when you open a file
    ignore_install = {},  -- none
  },
  config = function(_, opts)
    require('nvim-treesitter.configs').setup(opts)
  end,
}
