This is a simple attempt to only highlight Vim9 and legacy script
comments in the appropriate syntactic contexts.
Vim9 comments are highlighted at top level in a Vim9 script file, in all
:def functions, and in all :au and :com command blocks. Legacy script
comments are highlighted at top level in a legacy script file and in all
:func functions.
It attempts to fix #13047 and #11307 with minimal disruption to the
existing syntax definition as there is currently no maintainer
oversight.
I ran some comparison tests across runtime/*.vim and it doesn't appear
to break anything.
I am aware that the Vim9 comment matching, in particular, could be
greatly simplified but duplicating it for the moment seems like the
easiest strategy. Syntax files can be extremely fragile.
https://github.com/vim/vim/pull/13104
(4 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Merging #13104 (552a79d) into master (ad29f6a) will increase coverage by
0.50%.
The diff coverage isn/a.
@@ Coverage Diff @@ ## master #13104 +/- ## ========================================== + Coverage 76.67% 77.18% +0.50% ========================================== Files 150 150 Lines 152416 152381 -35 Branches 39282 39256 -26 ========================================== + Hits 116872 117609 +737 + Misses 23519 22583 -936 - Partials 12025 12189 +164
| Flag | Coverage Δ | |
|---|---|---|
| mingw-x64-HUGE | ? |
|
| mingw-x86-HUGE | 77.18% <ø> (?) |
|
| windows | 77.18% <ø> (+0.50%) |
⬆️ |
Flags with carried forward coverage won't be shown. Click here to find out more.
see 101 files with indirect coverage changes
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@dkearns pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@dkearns pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@dkearns pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@dkearns pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Thanks. Can you please rebase and resolve the existing conflicts?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
thanks.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra approved this pull request.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Merged #13104 into master.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Hi @zeertzjq, before this improvement I was able to "lower" vimscript syntax noise by substituting vimCommand syntax group with minimum set of keywords:
syn clear vimCommand
syn keyword vimCommand contained vim9cmd vim9script import autoload export def enddef call function endfunction defer defcompile delfunction return
syn keyword vimCommand contained if else elseif endif
syn keyword vimCommand contained for endfor while endwhile continue break
syn keyword vimCommand contained class endclass interface endinterface enum endenum
syn keyword vimCommand contained throw try endtry catch finally
syn keyword vimCommand contained silent unsilent
syn keyword vimCommand contained public static final const var let unlet
syn keyword vimCommand contained highlight runtime source eval finish verbose command delcommand
However now it somehow influences comment highlighting:
Before the patch:
Could you suggest how can I set my own keywords for vimCommand?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
oops, sorry @zeertzjq, I meant to ping @dkearns
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
If I change vimPreVim9script to:
syn region vimPreVim9script start="\%^" end="^\s*vim9s\%[cript]\>" contains=@vimLegacyTop,vimComment,vimLineComment keepend
adding keepend and removing \zs -- my changes to vimCommand work how it was before:
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@habamax, do you do that because of all the false positive matches for commands? I have a fix for that if I can catch enough edge cases not to annoy everyone in the short term.
Could you please try this patch with your additions and check folding works for a legacy header section before vim9script?
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index c016703b6..1562476f1 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -872,10 +872,11 @@ syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' e if s:vim9script syn cluster vimLegacyTop contains=TOP,vimPreVim9script,vim9Comment,vim9LineComment - syn region vimPreVim9script start="\%^" end="^\ze\s*vim9s\%[cript]\>" contains=@vimLegacyTop,vimComment,vimLineComment + syn region vimPreVim9script start="\%^" end="^\ze\s*vim9s\%[cript]\>" contains=@vimLegacyTop,vimComment,vimLineComment fold - syn keyword vim9ScriptArg noclear - syn keyword vimCommand vim9s[cript] nextgroup=vim9ScriptArg skipwhite + syn keyword vim9ScriptArg noclear + syn keyword vim9Script vim9s[cript] nextgroup=vim9ScriptArg skipwhite + hi def link vim9Script vimCommand endif " Embedded Scripts: {{{2
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
do you do that because of all the false positive matches for commands?
Yes, short abbreviated commands especially.
I have a fix for that if I can catch enough edge cases not to annoy everyone in the short term
Would be glad to check it out once it is available.
Could you please try this patch with your additions and check folding works for a legacy header section before vim9script?
Looks like it works:
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()