Treesitter integration
wookayin opened this issue · 4 comments
Continued from #27
Basic support (syntax, folding)
- ✅ https://github.com/nvim-treesitter/nvim-treesitter
- ✅ Debugging: https://github.com/nvim-treesitter/playground
Note: Treesitter's syntax highlight overrides existing python syntax, which is annoying It should also replace semshi (since most use cases are covered). It also breaks some other plugins that rely on highlight groups (e.g. vim-autoimport) becauseWhen TS is enabled, old vim regex highlights should be avoided (they usually don't work together nicely).synID
cannot retrieve dynamic highlights.
Some cool plugins powered by treesitter
See https://github.com/nvim-treesitter/nvim-treesitter/wiki/Extra-modules-and-plugins for a comprehensive list
- https://github.com/romgrk/nvim-treesitter-context (replaces context.nvim)
- https://github.com/nvim-treesitter/nvim-treesitter-refactor
- https://github.com/nvim-treesitter/nvim-treesitter-textobjects
- https://github.com/RRethy/nvim-treesitter-endwise (automatically inserts
end
) - https://github.com/RRethy/nvim-treesitter-textsubjects (smart subjects)
- https://github.com/windwp/nvim-autopairs (autopair)
- https://github.com/windwp/nvim-ts-autotag (automatically inserts end HTML tag)
- https://github.com/andymass/vim-matchup/ (enhanced
%
) - https://github.com/haringsrob/nvim_context_vt
To make (some) treesitter modules work properly with up-to-date parse tree as text change, either playground-highlight module needs to be enabled or some workaround like ec2f252 is needed, when one doesn't want to use playground's highlight/syntax feature yet.
Improved python folding -- the whole function/class is now foldable, rather than its body only (which should also be fixed in the upstream soon).
Some issues with treesitter highlights (for lua): embedded vimscripts vim.cmd [[ ... ]]
are highlighted as @string
:
-> Workaround discussed in https://www.reddit.com/r/neovim/comments/1059xht/comment/j3dw7ty/
See 5a4b971
- Most of core filetypes (lua, cpp, vim, rust, tex, etc.) now use treesitter highlights (see be7102e). See individual filetype plugins.
- Automatic parser installation and error recovery utils are added.
- Some treesitter utilities: 91b77f0.
Closing as done. Configurations for advanced plugins will be added in the next steps.