Skip to content

Commit 1347eb5

Browse files
committed
Check that vim.diagnostic.config().signs is a table with a text key. #142
1 parent 00afa98 commit 1347eb5

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

autoload/scrollview.vim

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,16 @@ for [s:key, s:fallback, s:sign, s:severity, s:name] in s:diagnostics_symbol_data
190190
" keys or contain only string key"). When the same type of diagnostic
191191
" has both a code and name key, the code key takes precedence.
192192
" https://github.com/neovim/neovim/pull/26193#issue-2009346914
193-
let g:[s:key] = luaeval(
194-
\ printf('vim.diagnostic.config().signs.text[%d]', s:severity))
195-
if g:[s:key] is# v:null
196-
let g:[s:key] = luaeval(
197-
\ printf('vim.diagnostic.config().signs.text["%s"]', s:name))
193+
" WARN: Neovim diagnostic signs can be configured with a function
194+
" (that takes namespace and bufnr). That's not supported here.
195+
if luaeval('type(vim.diagnostic.config().signs)') ==# 'table'
196+
\ && luaeval('vim.diagnostic.config().signs.text') isnot# v:null
197+
let g:[s:key] =
198+
\ luaeval('vim.diagnostic.config().signs.text[_A]', s:severity)
199+
if g:[s:key] is# v:null
200+
let g:[s:key] =
201+
\ luaeval('vim.diagnostic.config().signs.text[_A]', s:name)
202+
endif
198203
endif
199204
if g:[s:key] is# v:null
200205
let g:[s:key] = s:fallback

0 commit comments

Comments
 (0)