summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2023-12-19 19:42:30 +0900
committerGitHub <noreply@github.com>2023-12-19 19:42:30 +0900
commit79dcd0e24cbcabc06fc06e9dba4de8faeb0fedb5 (patch)
tree1fb579cc57fb304c15f388a7b4ccf5074ea7443e
parentUpdate parsers: elm, gomod, v, wing (diff)
downloadnvim-treesitter-79dcd0e24cbcabc06fc06e9dba4de8faeb0fedb5.tar
nvim-treesitter-79dcd0e24cbcabc06fc06e9dba4de8faeb0fedb5.tar.gz
nvim-treesitter-79dcd0e24cbcabc06fc06e9dba4de8faeb0fedb5.tar.bz2
nvim-treesitter-79dcd0e24cbcabc06fc06e9dba4de8faeb0fedb5.tar.lz
nvim-treesitter-79dcd0e24cbcabc06fc06e9dba4de8faeb0fedb5.tar.xz
nvim-treesitter-79dcd0e24cbcabc06fc06e9dba4de8faeb0fedb5.tar.zst
nvim-treesitter-79dcd0e24cbcabc06fc06e9dba4de8faeb0fedb5.zip
fix: remove 0-length range usage in indent.lua (#5805)
-rw-r--r--lua/nvim-treesitter/indent.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua
index 80e0bc77b..18d239571 100644
--- a/lua/nvim-treesitter/indent.lua
+++ b/lua/nvim-treesitter/indent.lua
@@ -23,7 +23,7 @@ end
---@return TSNode
local function get_first_node_at_line(root, lnum, col)
col = col or vim.fn.indent(lnum)
- return root:descendant_for_range(lnum - 1, col, lnum - 1, col)
+ return root:descendant_for_range(lnum - 1, col, lnum - 1, col + 1)
end
---@param root TSNode
@@ -32,7 +32,7 @@ end
---@return TSNode
local function get_last_node_at_line(root, lnum, col)
col = col or (#getline(lnum) - 1)
- return root:descendant_for_range(lnum - 1, col, lnum - 1, col)
+ return root:descendant_for_range(lnum - 1, col, lnum - 1, col + 1)
end
---@param node TSNode
@@ -124,7 +124,7 @@ function M.get_indent(lnum)
-- some languages like Python will actually have worse results when re-parsing at opened new line
if not M.avoid_force_reparsing[root_lang] then
-- Reparse in case we got triggered by ":h indentkeys"
- parser:parse { vim.fn.line "w0" - 1, vim.fn.line "w$" - 1 }
+ parser:parse { vim.fn.line "w0" - 1, vim.fn.line "w$" }
end
-- Get language tree with smallest range around node that's not a comment parser