We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cc82b77 commit 42cb142Copy full SHA for 42cb142
1 file changed
init.lua
@@ -2102,8 +2102,12 @@ require('lazy').setup({
2102
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
2103
-- vim.wo.foldmethod = 'expr'
2104
2105
+ -- check if treesitter indentation is available for this language, and if so enable it
2106
+ -- in case there is no indent query, the indentexpr will fallback to the vim's built in one
2107
+ local has_indent_query = vim.treesitter.query.get(language, 'indent') ~= nil
2108
+
2109
-- enables treesitter based indentation
- vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
2110
+ if has_indent_query then vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end
2111
end
2112
2113
local available_parsers = require('nvim-treesitter').get_available()
0 commit comments