mirror of
https://github.com/neovim/neovim.git
synced 2026-04-19 05:50:39 +00:00
fix(diagnostic): check for extmark in get_logical_pos #37127
Problem: The function get_logical_pos did not account for the possibility that a diagnostic might not have an associated extmark, leading to potential errors or incorrect behavior. Solution: Add a check for diagnostic._extmark_id and return the logical positions directly if it does not exist.
This commit is contained in:
@@ -655,6 +655,10 @@ local sign_highlight_map = make_highlight_map('Sign')
|
||||
--- @return integer end_col
|
||||
--- @return boolean valid
|
||||
local function get_logical_pos(diagnostic)
|
||||
if not diagnostic._extmark_id then
|
||||
return diagnostic.lnum, diagnostic.col, diagnostic.end_lnum, diagnostic.end_col, true
|
||||
end
|
||||
|
||||
local ns = M.get_namespace(diagnostic.namespace)
|
||||
local extmark = api.nvim_buf_get_extmark_by_id(
|
||||
diagnostic.bufnr,
|
||||
|
||||
Reference in New Issue
Block a user