summaryrefslogtreecommitdiff
path: root/syntax
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2023-09-06 00:21:58 +0100
committerw0rp <devw0rp@gmail.com>2023-09-06 00:21:58 +0100
commit14350dbb0d265ef87d1c7d420d89fb4165a2b131 (patch)
treeee157f9d69298646b44f3033f6e9ad8745303c74 /syntax
parent551fbcfb0905629dcc2afc0db53dcca21994cca3 (diff)
downloadale-14350dbb0d265ef87d1c7d420d89fb4165a2b131.zip
Close #3368 - Supercharge :ALEInfo
Make a series of sweeping changes to make :ALEInfo more useful. 1. Deprecate :ALEInfoToClipboard and support :ALEInfo -clipboard 2. Permit :ALEInfo -clip as a shorthand for :ALEInfo -clipboard 3. Support :ALEInfo -preview to render in the preview window 4. Support :ALEInfo -echo for the classic :ALEInfo mode 5. Change the default mode to 'preview', and make it configurable 6. Add syntax highlighting for ALEInfo in preview mode 7. Add a convenience to look up documentatation that explains itself 8. Don't show an empty 'Linter Variables' section
Diffstat (limited to 'syntax')
-rw-r--r--syntax/ale-fix-suggest.vim2
-rw-r--r--syntax/ale-info.vim30
2 files changed, 31 insertions, 1 deletions
diff --git a/syntax/ale-fix-suggest.vim b/syntax/ale-fix-suggest.vim
index b112f5b5..19734f4c 100644
--- a/syntax/ale-fix-suggest.vim
+++ b/syntax/ale-fix-suggest.vim
@@ -3,7 +3,7 @@ if exists('b:current_syntax')
endif
syn match aleFixerComment /^.*$/
-syn match aleFixerName /\(^\|, \)'[^']*'/
+syn match aleFixerName /\(^ *\|, \)'[^']*'/
syn match aleFixerHelp /^See :help ale-fix-configuration/
hi def link aleFixerComment Comment
diff --git a/syntax/ale-info.vim b/syntax/ale-info.vim
new file mode 100644
index 00000000..d47b58b8
--- /dev/null
+++ b/syntax/ale-info.vim
@@ -0,0 +1,30 @@
+if exists('b:current_syntax')
+ finish
+endif
+
+" Exhaustively list different ALE Info directives to match here.
+" This should hopefully avoid matching too eagerly.
+syn match aleInfoDirective /^ *Current Filetype:/
+syn match aleInfoDirective /^ *Available Linters:/
+syn match aleInfoDirective /^ *Enabled Linters:/
+syn match aleInfoDirective /^ *Ignored Linters:/
+syn match aleInfoDirective /^ *Suggested Fixers:/
+syn match aleInfoDirective /^ *Command History:/
+
+syn match aleCommandNoOutput /^<<<NO OUTPUT RETURNED>>>$/
+
+hi def link aleInfoDirective Title
+hi def link aleInfoDirective Title
+hi def link aleCommandNoOutput Comment
+
+" Use Vim syntax highlighting for Vim options.
+unlet! b:current_syntax
+syntax include @srcVim syntax/vim.vim
+syntax region aleInfoVimRegionLinter matchgroup=aleInfoDirective start="^ *Linter Variables:$" end="^ $" contains=@srcVim
+syntax region aleInfoVimRegionGlobal matchgroup=aleInfoDirective start="^ *Global Variables:$" end="^ $" contains=@srcVim
+
+unlet! b:current_syntax
+syntax include @srcAleFixSuggest syntax/ale-fix-suggest.vim
+syntax region aleInfoFixSuggestRegion matchgroup=aleInfoDirective start="^ *Suggested Fixers:$" end="^ $" contains=@srcAleFixSuggest
+
+let b:current_syntax = 'ale-info'