fix: is_in_node_range now includes end line and col

This fixes no indents at the end of python files

Refs #1136
This commit is contained in:
partizan 2021-08-26 23:39:10 +03:00 committed by GitHub
parent 1e4c846d01
commit 5a721fef56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -227,19 +227,7 @@ end
-- @param col A column (0-based)
function M.is_in_node_range(node, line, col)
local start_line, start_col, end_line, end_col = node:range()
if line >= start_line and line <= end_line then
if line == start_line and line == end_line then
return col >= start_col and col < end_col
elseif line == start_line then
return col >= start_col
elseif line == end_line then
return col < end_col
else
return true
end
else
return false
end
return line >= start_line and line <= end_line and col >= start_col and col <= end_col
end
function M.get_node_range(node_or_range)