# Display the diagnostic messages from the LSP server for the current buffer
# in a location list
export def ShowAllDiags(): void
- var save_winid = win_getid()
-
if !DiagsUpdateLocList(bufnr())
util.WarnMsg($'No diagnostic messages found for {@%}')
return
endif
+ var save_winid = win_getid()
:lopen
if !opt.lspOptions.keepFocusInDiags
save_winid->win_gotoid()
:cclose
g:LspOptionsSet({ useQuickfixForLocations: false })
+ # Test for moving buffer focus to loclist
+ g:LspOptionsSet({ keepFocusInReferences: true })
+ :LspShowReferences
+ assert_equal('quickfix', getwinvar(0, '&buftype'))
+ :lclose
+ g:LspOptionsSet({ keepFocusInReferences: false })
+
# Test for LspPeekReferences
# Opening the preview window with an unsaved buffer displays the "E37: No
output = execute('LspDiagPrev')->split("\n")
assert_equal('Warn: No more diagnostics found', output[0])
+ # Test for maintaining buffer focus
+ g:LspOptionsSet({ keepFocusInDiags: false })
+ :LspDiagShow
+ assert_equal('', getwinvar(0, '&buftype'))
+ :lclose
+ g:LspOptionsSet({ keepFocusInDiags: true })
+
# :[count]LspDiagNext
cursor(3, 1)
:2LspDiagNext