From f742ecbabd8e9408ad27dd7f39d2a30a1e641ecf Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Sat, 22 Jul 2023 07:24:53 +0100 Subject: [PATCH] Address #4165: provide a highlight group for the detailed diagnostic popup This seems to work, but I have a few questions - What tests should I look at to understand how to write one for this change? - Are you happy with the name `YcmErrorPopup`? - What should I set as `'priority'`, `'combine'`, `'override'`? --- README.md | 4 ++++ autoload/youcompleteme.vim | 4 ++++ doc/youcompleteme.txt | 4 ++++ python/ycm/youcompleteme.py | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b4bd2b11de..9d60804fd8 100644 --- a/README.md +++ b/README.md @@ -1770,6 +1770,10 @@ You can also style the line that has the warning/error with these groups: - `YcmWarningLine`, which falls back to group `SyntasticWarningLine` if it exists +Finally, you can also style the popup for the detailed diagnostics (it is shown +if `g:ycm_show_detailed_diag_in_popup` is set) using the group `YcmErrorPopup`, +which falls back to `ErrorMsg`. + Note that the line highlighting groups only work when the [`g:ycm_enable_diagnostic_signs`](#the-gycm_enable_diagnostic_signs-option) option is set. If you want highlighted lines but no signs in the Vim gutter, diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index f525316dcb..aacbf6e95c 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -512,6 +512,10 @@ function! s:SetUpSyntaxHighlighting() \ 'combine': 0, \ 'override': 1 } ) endif + + if !hlexists( 'YcmErrorPopup' ) + highlight default link YcmErrorPopup ErrorMsg + endif endfunction diff --git a/doc/youcompleteme.txt b/doc/youcompleteme.txt index decfa99ae4..c16c100e2c 100644 --- a/doc/youcompleteme.txt +++ b/doc/youcompleteme.txt @@ -2017,6 +2017,10 @@ You can also style the line that has the warning/error with these groups: - 'YcmWarningLine', which falls back to group 'SyntasticWarningLine' if it exists +Finally, you can also style the popup for the detailed diagnostics (it is shown +if |g:ycm_show_detailed_diag_in_popup| is set) using the group 'YcmErrorPopup', +which falls back to |ErrorMsg|. + Note that the line highlighting groups only work when the |g:ycm_enable_diagnostic_signs| option is set. If you want highlighted lines but no signs in the Vim gutter, set the 'signcolumn' option to 'no' in your diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index 5d9ac6cd15..d7eb18862b 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -849,7 +849,7 @@ def ShowDetailedDiagnostic( self, message_in_popup ): 'maxwidth': available_columns, 'close': 'click', 'fixed': 0, - 'highlight': 'ErrorMsg', + 'highlight': 'YcmErrorPopup', 'border': [ 1, 1, 1, 1 ], # Close when moving cursor 'moved': 'expr',