mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 20:10:10 -04:00
indents(c): add zero_indent for #if
This commit is contained in:
parent
616dc885fc
commit
fd5a551d7c
7 changed files with 18 additions and 13 deletions
|
|
@ -35,6 +35,7 @@ local get_indents = tsutils.memoize_by_buf_tick(function(bufnr, root, lang)
|
|||
branch = {},
|
||||
ignore = {},
|
||||
aligned_indent = {},
|
||||
zero_indent = {},
|
||||
}
|
||||
|
||||
for name, node, metadata in queries.iter_captures(bufnr, "indents", root, lang) do
|
||||
|
|
@ -88,6 +89,10 @@ function M.get_indent(lnum)
|
|||
-- tracks to ensure multiple indent levels are not applied for same line
|
||||
local is_processed_by_row = {}
|
||||
|
||||
if q.zero_indent[node:id()] then
|
||||
return 0
|
||||
end
|
||||
|
||||
while node do
|
||||
-- do 'autoindent' if not marked as @indent
|
||||
if not q.indent[node:id()] and q.auto[node:id()] and node:start() < lnum - 1 and lnum - 1 <= node:end_() then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue