@@ -207,7 +207,49 @@ Valid options: "off" | "messages" | "verbose"
207207List used to fill diagnostic messages.
208208
209209Default: "Quickfix"
210- Valid options: "Quickfix" | "Location" | "Disabled"
210+ Valid options: "Quickfix" | "Location" | "Disabled" | | Funcref|
211+
212+ If you use a | Funcref | , the referenced function should have two arguments
213+ (filename, diagnostics). filename is the name of the file of which the
214+ diagnostics correspond to, and diagnostics is the list of diagnostics for said
215+ file. Those diagnostics are as specified in the LSP specification.
216+
217+ For example, if you wanted to use `dense- analysis/ale` to display diagnostics
218+ instead of this plugin you could use something like this:
219+
220+ ```
221+ function! DisplayDiagnostics(filename, diagnostics) abort
222+ let s:diagnostics = []
223+
224+ for d in a:diagnostics
225+ let s:severity = 'I'
226+ if d.severity == 1
227+ let s:severity = 'E'
228+ elseif d.severity == 2
229+ let s:severity = 'W'
230+ endif
231+
232+ call add(s:diagnostics, {
233+ \ "filename": a:filename,
234+ \ "text": d.message,
235+ \ "lnum": d.range.start.line + 1,
236+ \ "end_lnum": d.range.end.line + 1,
237+ \ "col": d.range.end.character,
238+ \ "end_col": d.range.end.character,
239+ \ "type": s:severity,
240+ \ })
241+ endfor
242+
243+ call ale#other_source#ShowResults(bufnr('%'), 'LanguageClientNeovim', s:diagnostics)
244+ endfunction
245+
246+ let g:LanguageClient_diagnosticsDisplayFuncref = function('DisplayDiagnostics')
247+ ```
248+
249+ Keep in mind that to complete the integration between `ale` and
250+ `LanguageClient- neovim` you need to add `LanguageClientNeovim` (or the name of
251+ the linter you used in the call to ShowResults) to the list of linters to be
252+ used in `ale` .
211253
2122542.10 g:LanguageClient_diagnosticsEnable *g:LanguageClient_diagnosticsEnable*
213255
@@ -635,51 +677,6 @@ Highlight group to be used for code lens.
635677
636678Default: 'Comment'
637679
638- 2.42 g:LanguageClient_diagnosticsDisplayFuncref *g:LanguageClient_diagnosticsDisplayFuncref*
639-
640- If set, LanguageClient-neovim will call this function instead of setting the diagnostics signs. This
641- is useful to delegate the display of diagnostics to other engines. The function is called with two
642- arguments, the first one is the file name of which the diagnostics correspond to, and the seconds one
643- is the list of diagnostics for said file. Those diagnostics are as specified in the LSP specification.
644-
645- For example, if you wanted to use `dense- analysis/ale` to display diagnostics instead of this plugin
646- you could use something like this:
647-
648- ```
649- function! g:DisplayDiagnostics(filename, diagnostics) abort
650- let s:diagnostics = []
651-
652- for d in a:diagnostics
653- let s:severity = 'I'
654- if d.severity == 1
655- let s:severity = 'E'
656- elseif d.severity == 2
657- let s:severity = 'W'
658- endif
659-
660- call add(s:diagnostics, {
661- \ "filename": a:filename,
662- \ "text": d.message,
663- \ "lnum": d.range.start.line + 1,
664- \ "end_lnum": d.range.end.line + 1,
665- \ "col": d.range.end.character,
666- \ "end_col": d.range.end.character,
667- \ "type": s:severity,
668- \ })
669- endfor
670-
671- call ale#other_source#ShowResults(bufnr('%'), 'LanguageClientNeovim', s:diagnostics)
672- endfunction
673-
674- let g:LanguageClient_diagnosticsDisplayFuncref = 'g:DisplayDiagnostics'
675- ```
676-
677- Keep in mind that to complete the integration between `ale` and `LanguageClient- neovim` you need to
678- add `LanguageClientNeovim` (or the name of the linter you used in the call to ShowResults) to the list
679- of linters to be used in `ale` .
680-
681- Default: v:null
682-
683680==============================================================================
6846813. Commands *LanguageClientCommands*
685682
0 commit comments