aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorMunif Tanjim <hello@muniftanjim.dev>2022-01-21 17:11:46 +0600
committerChristian Clason <christian.clason@uni-due.de>2022-01-21 16:40:36 +0100
commit8f9d4ada354d7a64e6679b421387e600445316e1 (patch)
tree34becf3a20e630fdc1c55cbbe5595085bcd50cc0 /lua
parentfeat(indent): support `@aligned_indent` for python (diff)
downloadnvim-treesitter-8f9d4ada354d7a64e6679b421387e600445316e1.tar
nvim-treesitter-8f9d4ada354d7a64e6679b421387e600445316e1.tar.gz
nvim-treesitter-8f9d4ada354d7a64e6679b421387e600445316e1.tar.bz2
nvim-treesitter-8f9d4ada354d7a64e6679b421387e600445316e1.tar.lz
nvim-treesitter-8f9d4ada354d7a64e6679b421387e600445316e1.tar.xz
nvim-treesitter-8f9d4ada354d7a64e6679b421387e600445316e1.tar.zst
nvim-treesitter-8f9d4ada354d7a64e6679b421387e600445316e1.zip
feat(indent): ecma - support try_catch and if_else
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/indent.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua
index 92dab1587..eca649b23 100644
--- a/lua/nvim-treesitter/indent.lua
+++ b/lua/nvim-treesitter/indent.lua
@@ -31,6 +31,7 @@ local get_indents = tsutils.memoize_by_buf_tick(function(bufnr, root, lang)
local map = {
auto = {},
indent = {},
+ indent_end = {},
dedent = {},
branch = {},
ignore = {},
@@ -70,6 +71,9 @@ function M.get_indent(lnum)
if is_empty_line then
local prevlnum = vim.fn.prevnonblank(lnum)
node = get_last_node_at_line(root, prevlnum)
+ if q.indent_end[node:id()] then
+ node = get_first_node_at_line(root, lnum)
+ end
else
node = get_first_node_at_line(root, lnum)
end