mirror of
https://github.com/neovim/neovim.git
synced 2025-11-16 07:11:20 +00:00
fix: treesitter languagetree crash when using telescope buffer previewer (#13986)
This commit is contained in:
@@ -249,17 +249,17 @@ end
|
|||||||
--
|
--
|
||||||
-- @param regions A list of regions this tree should manage and parse.
|
-- @param regions A list of regions this tree should manage and parse.
|
||||||
function LanguageTree:set_included_regions(regions)
|
function LanguageTree:set_included_regions(regions)
|
||||||
-- Transform the tables from 4 element long to 6 element long (with byte offset)
|
-- TODO(vigoux): I don't think string parsers are useful for now
|
||||||
for _, region in ipairs(regions) do
|
if type(self._source) == "number" then
|
||||||
for i, range in ipairs(region) do
|
-- Transform the tables from 4 element long to 6 element long (with byte offset)
|
||||||
if type(range) == "table" and #range == 4 then
|
for _, region in ipairs(regions) do
|
||||||
-- TODO(vigoux): I don't think string parsers are useful for now
|
for i, range in ipairs(region) do
|
||||||
if type(self._source) == "number" then
|
if type(range) == "table" and #range == 4 then
|
||||||
local start_row, start_col, end_row, end_col = unpack(range)
|
local start_row, start_col, end_row, end_col = unpack(range)
|
||||||
-- Easy case, this is a buffer parser
|
-- Easy case, this is a buffer parser
|
||||||
-- TODO(vigoux): proper byte computation here, and account for EOL ?
|
-- TODO(vigoux): proper byte computation here, and account for EOL ?
|
||||||
local start_byte = a.nvim_buf_get_offset(self.bufnr, start_row) + start_col
|
local start_byte = a.nvim_buf_get_offset(self._source, start_row) + start_col
|
||||||
local end_byte = a.nvim_buf_get_offset(self.bufnr, end_row) + end_col
|
local end_byte = a.nvim_buf_get_offset(self._source, end_row) + end_col
|
||||||
|
|
||||||
region[i] = { start_row, start_col, start_byte, end_row, end_col, end_byte }
|
region[i] = { start_row, start_col, start_byte, end_row, end_col, end_byte }
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user