summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorMagnus Groß <21310755+vimpostor@users.noreply.github.com>2021-12-09 15:21:39 +0100
committerGitHub <noreply@github.com>2021-12-09 23:21:39 +0900
commit9860dadbc952b227b2d25269e717ae801c5d6f2c (patch)
tree276866e1ac7f55ff734d49b8e374b4abb060ceff /autoload
parentde67f4743d9ffd1694d15b1b91fedfaa0a5cda70 (diff)
downloadale-9860dadbc952b227b2d25269e717ae801c5d6f2c.zip
Initialize hl-groups correctly if virtual text is loaded first (#3960)
If virtualtext.vim is autoloaded first, it will link ALEVirtualTextWarning to ALEWarning. But ALEWarning is not initialized yet, so it will create ALEWarning, but with no color definition set. Shortly after, highlight.vim is autoloaded, which would usually link ALEWarning to SpellCap, but only if ALEWarning is not already set. However since ALEWarning is already initialized due to the previous link, we skip this and never actually come around to properly initializing it. We fix this by initializing all highlight groups in highlight.vim, thus satisfying the dependency of ALEVirtualTextWarning being initialized after ALEWarning. Fixes #3585
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/highlight.vim20
-rw-r--r--autoload/ale/virtualtext.vim20
2 files changed, 20 insertions, 20 deletions
diff --git a/autoload/ale/highlight.vim b/autoload/ale/highlight.vim
index 473ad354..c284f5ca 100644
--- a/autoload/ale/highlight.vim
+++ b/autoload/ale/highlight.vim
@@ -22,6 +22,26 @@ if !hlexists('ALEInfo')
highlight link ALEInfo ALEWarning
endif
+if !hlexists('ALEVirtualTextError')
+ highlight link ALEVirtualTextError ALEError
+endif
+
+if !hlexists('ALEVirtualTextStyleError')
+ highlight link ALEVirtualTextStyleError ALEVirtualTextError
+endif
+
+if !hlexists('ALEVirtualTextWarning')
+ highlight link ALEVirtualTextWarning ALEWarning
+endif
+
+if !hlexists('ALEVirtualTextStyleWarning')
+ highlight link ALEVirtualTextStyleWarning ALEVirtualTextWarning
+endif
+
+if !hlexists('ALEVirtualTextInfo')
+ highlight link ALEVirtualTextInfo ALEVirtualTextWarning
+endif
+
" The maximum number of items for the second argument of matchaddpos()
let s:MAX_POS_VALUES = 8
let s:MAX_COL_SIZE = 1073741824 " pow(2, 30)
diff --git a/autoload/ale/virtualtext.vim b/autoload/ale/virtualtext.vim
index 598bc1bf..345deb70 100644
--- a/autoload/ale/virtualtext.vim
+++ b/autoload/ale/virtualtext.vim
@@ -18,26 +18,6 @@ elseif has('textprop') && has('popupwin')
let s:has_virt_text = 1
endif
-if !hlexists('ALEVirtualTextError')
- highlight link ALEVirtualTextError ALEError
-endif
-
-if !hlexists('ALEVirtualTextStyleError')
- highlight link ALEVirtualTextStyleError ALEVirtualTextError
-endif
-
-if !hlexists('ALEVirtualTextWarning')
- highlight link ALEVirtualTextWarning ALEWarning
-endif
-
-if !hlexists('ALEVirtualTextStyleWarning')
- highlight link ALEVirtualTextStyleWarning ALEVirtualTextWarning
-endif
-
-if !hlexists('ALEVirtualTextInfo')
- highlight link ALEVirtualTextInfo ALEVirtualTextWarning
-endif
-
function! ale#virtualtext#Clear() abort
if !s:has_virt_text
return