diff options
author | Jongwook Choi <wookayin@gmail.com> | 2023-10-27 09:17:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-27 08:17:46 -0500 |
commit | add1b10b79011d1af61419a63cc8ef4645f45bbf (patch) | |
tree | 44e20b13124d859a90fc155592f3282c34722012 /test/functional/lua/diagnostic_spec.lua | |
parent | 4fcdfa5ad01fd8f7e8c0e044fcf004692c0889d5 (diff) | |
download | rneovim-add1b10b79011d1af61419a63cc8ef4645f45bbf.tar.gz rneovim-add1b10b79011d1af61419a63cc8ef4645f45bbf.tar.bz2 rneovim-add1b10b79011d1af61419a63cc8ef4645f45bbf.zip |
fix(diagnostic): virtual_text prefix function should have index and total (#25801)
The prefix option of the diagnostic virtual text can be a function,
but previously it was only a function of diagnostic.
This function should also have additional parameters index and total,
more consistently and similarily as in the prefix function for
`vim.diagnostic.open_float()`.
These additional parameters will be useful when there are too many
number of diagnostics in a single line.
Diffstat (limited to 'test/functional/lua/diagnostic_spec.lua')
-rw-r--r-- | test/functional/lua/diagnostic_spec.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua index 8deb2e0726..f061fac50a 100644 --- a/test/functional/lua/diagnostic_spec.lua +++ b/test/functional/lua/diagnostic_spec.lua @@ -1237,7 +1237,7 @@ end) return prefix .. message ]]) - eq('[err-code] Some error', exec_lua [[ + eq('[(1/1) err-code] Some error', exec_lua [[ local diagnostics = { make_error('Some error', 0, 0, 0, 0, nil, 'err-code'), } @@ -1245,7 +1245,7 @@ end) vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, diagnostics, { underline = false, virtual_text = { - prefix = function(diag) return string.format('[%s]', diag.code) end, + prefix = function(diag, i, total) return string.format('[(%d/%d) %s]', i, total, diag.code) end, suffix = '', } }) |