diff options
| author | Kira Kawai <66677201+ras0q@users.noreply.github.com> | 2026-01-02 15:49:28 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-02 01:49:28 -0500 |
| commit | 3ac76977bca5ce204fea856d69d52895f67332e5 (patch) | |
| tree | fba153ddd522364528f0377c150d2a6ad2d7330e /runtime/lua/vim/diagnostic.lua | |
| parent | ed562c296abeac25fc5d81708b9ada09da608772 (diff) | |
| download | rneovim-3ac76977bca5ce204fea856d69d52895f67332e5.tar.gz rneovim-3ac76977bca5ce204fea856d69d52895f67332e5.tar.bz2 rneovim-3ac76977bca5ce204fea856d69d52895f67332e5.zip | |
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.
Diffstat (limited to 'runtime/lua/vim/diagnostic.lua')
| -rw-r--r-- | runtime/lua/vim/diagnostic.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 002d9a63cb..37089f972e 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -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, |