fix(sidebar): do not error when selecting text from help window (#2514)
This commit is contained in:
@@ -1364,9 +1364,8 @@ function Sidebar:on_mount(opts)
|
|||||||
-- Treesitter highlighting is active in the code buffer, activate it
|
-- Treesitter highlighting is active in the code buffer, activate it
|
||||||
-- it in code selection buffer as well.
|
-- it in code selection buffer as well.
|
||||||
local filetype = vim.bo[self.code.bufnr].filetype
|
local filetype = vim.bo[self.code.bufnr].filetype
|
||||||
if filetype and filetype ~= "" then
|
local lang = vim.treesitter.language.get_lang(filetype or "")
|
||||||
vim.treesitter.start(selected_code_buf, vim.bo[self.code.bufnr].filetype)
|
if lang and lang ~= "" then vim.treesitter.start(selected_code_buf, lang) end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
-- Try the old syntax highlighting
|
-- Try the old syntax highlighting
|
||||||
local syntax = api.nvim_get_option_value("syntax", { buf = self.code.bufnr })
|
local syntax = api.nvim_get_option_value("syntax", { buf = self.code.bufnr })
|
||||||
|
|||||||
Reference in New Issue
Block a user