summaryrefslogtreecommitdiff
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
parentbb60706433e593f976fb6cfee3b3a6910ce5bd2c (diff)
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 92dab158..eca649b2 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