Add config.diagnostics to disable diagnostics per server (#828)

This commit is contained in:
Bastien Laine
2020-05-31 05:32:18 +08:00
committed by GitHub
parent 37e8a77687
commit db85c226cd
2 changed files with 13 additions and 1 deletions

View File

@@ -736,10 +736,12 @@ function! s:on_notification(server_name, id, data, event) abort
call lsp#log_verbose('<---', a:id, a:server_name, a:data)
let l:response = a:data['response']
let l:server = s:servers[a:server_name]
let l:server_info = l:server['server_info']
let l:lsp_diagnostics_config_enabled = get(get(l:server_info, 'config', {}), 'diagnostics', v:true)
if lsp#client#is_server_instantiated_notification(a:data)
if has_key(l:response, 'method')
if g:lsp_diagnostics_enabled && l:response['method'] ==# 'textDocument/publishDiagnostics'
if g:lsp_diagnostics_enabled && l:lsp_diagnostics_config_enabled && l:response['method'] ==# 'textDocument/publishDiagnostics'
call lsp#ui#vim#diagnostics#handle_text_document_publish_diagnostics(a:server_name, a:data)
elseif l:response['method'] ==# 'textDocument/semanticHighlighting'
call lsp#ui#vim#semantic#handle_semantic(a:server_name, a:data)

View File

@@ -893,6 +893,16 @@ The vim |dict| containing information about the server.
Example: >
'config': { 'completion_item_kinds': {'26': 'type' } }
<
* diagnostics
Type: |Boolean|
Default: |v:true|
This allows disablingdiagnostics per server. Useful when dealing
with multiple servers (One for diagnostic only)
Example: >
'config': { 'diagnostics': v:false }
<
refresh_pattern *vim-lsp-refresh_pattern*
Type: |String| (|pattern|)