All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 function! s:BuildConfigBlock(section, info) abort
2 let l:block = get(a:info, a:section, '')
4 return printf("### %s\n%s\n", a:section, l:block)
10 function! health#lsp#check() abort
11 call s:report_start('server status')
12 let l:server_status = lsp#collect_server_status()
14 let l:has_printed = v:false
15 for l:k in sort(keys(l:server_status))
16 let l:report = l:server_status[l:k]
18 let l:status_msg = printf('%s: %s', l:k, l:report.status)
19 if l:report.status == 'running'
20 call s:report_ok(l:status_msg)
21 elseif l:report.status == 'failed'
22 call health#report_error(l:status_msg, 'See :help g:lsp_log_verbose to debug server failure.')
24 call s:report_warn(l:status_msg)
26 let l:has_printed = v:true
30 call s:report_warn('no servers connected')
33 for l:k in sort(keys(l:server_status))
34 call s:report_start(printf('server configuration: %s', l:k))
35 let l:report = l:server_status[l:k]
38 let l:msg .= s:BuildConfigBlock('allowlist', l:report.info)
39 let l:msg .= s:BuildConfigBlock('blocklist', l:report.info)
40 let l:cfg = get(l:report.info, 'workspace_config', '')
42 if get(g:, 'loaded_scriptease', 0)
43 let l:cfg = scriptease#dump(l:cfg, {'width': &columns-1})
45 let l:cfg = json_encode(l:cfg)
46 " Add some whitespace to make it readable.
47 let l:cfg = substitute(l:cfg, '[,{(\[]', "&\n\t", 'g')
48 let l:cfg = substitute(l:cfg, '":', '& ', 'g')
49 let l:cfg = substitute(l:cfg, '\v[})\]]+', "\n&", 'g')
50 let l:cfg = substitute(l:cfg, '\n\s*\n', "\n", 'g')
52 let l:msg .= printf("### workspace_config\n```json\n%s\n```", l:cfg)
54 call health#report_info(l:msg)
57 call s:report_start('Performance')
58 if lsp#utils#has_lua() && g:lsp_use_lua
59 call s:report_ok('Using lua for faster performance.')
61 call s:report_warn('Missing requirements to enable lua for faster performance.')
66 function! s:report_start(report) abort
68 call v:lua.vim.health.start(a:report)
70 call health#report_start(a:report)
74 function! s:report_warn(report) abort
76 call v:lua.vim.health.warn(a:report)
78 call health#report_warn(a:report)
82 function! s:report_ok(report) abort
84 call v:lua.vim.health.ok(a:report)
86 call health#report_ok(a:report)