[vim/vim] Vim9: Fix: Ex-command :abstract, :interface snd :type can be shortened (PR #16356)

18 views
Skip to first unread message

h_east

unread,
Jan 1, 2025, 8:43:20 AMJan 1
to vim/vim, Subscribed

Related:

When I ran "$ make check_doc" with the improved generator script, I found that the following Vim9-specific Ex-commands can be shortened:

  • abstract
  • interface
  • type

Currently the behavior seems inconsistent.

  1. The outer abstract can be shortened.
vim9script
abs class ClassA
  abstract def FuncA()
endclass

No error

  1. The inner abstract cannot be shortened.
vim9script
abstract class ClassA
  abs def FuncA()
endclass

E1065: Command cannot be shortened: abs def FuncA()

  1. interface can be shortened.
vim9script
inte I
    def F()
endinterface

No error.

  1. endinterface cannot be shortened.
vim9script
interface I
    def F()
endin

E1065: Command cannot be shortened: endin

So, Based on Vim9 policy(:h vim9-no-shorten), it has been changed so that it cannot be shortened.

@yegappan, @dkearns Could you review this?


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/16356

Commit Summary

  • d30d256 Vim9: Fix: Ex-command :abstract, :interface snd :type can be shortened

File Changes

(6 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16356@github.com>

h_east

unread,
Jan 2, 2025, 6:25:18 AMJan 2
to vim/vim, Push

@h-east pushed 1 commit.

  • bb9b950 Vim9: Fix: Ex-command :abstract, :interface snd :type can be shortened


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16356/before/ef3d08285455c108a44d23a650a2d4252d883225/after/bb9b9503958acafc537dae31c4c7ede407bc2230@github.com>

h_east

unread,
Jan 2, 2025, 6:27:26 AMJan 2
to vim/vim, Subscribed

Fix issue that related #16362


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16356/c2567629245@github.com>

dkearns

unread,
Jan 2, 2025, 10:07:49 AMJan 2
to vim/vim, Subscribed

Thanks.

It looks good to me in principle but I'm not entirely clear on Bram's intention here. I sent him an update to the matchit pattern for enums and interfaces with support for the shortened names and it was included without comment at the time (early '23).


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16356/c2567915525@github.com>

Christian Brabandt

unread,
Jan 2, 2025, 11:45:30 AMJan 2
to vim/vim, Subscribed

Thanks,

I sent him an update to the matchit pattern for enums and interfaces with support for the shortened names

Then let's just revert this as well please? Let's try to be consistent and only allow the long names for vim9 script. It also helps readability.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16356/c2568063613@github.com>

Christian Brabandt

unread,
Jan 3, 2025, 4:15:19 AMJan 3
to vim/vim, Subscribed

I include it and update the screendump tests. But please check it, now it does no longer highlight properly? Or is this expected?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16356/c2568914964@github.com>

Christian Brabandt

unread,
Jan 3, 2025, 4:27:06 AMJan 3
to vim/vim, Subscribed

Closed #16356 via aa979c7.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16356/issue_event/15805713641@github.com>

h_east

unread,
Jan 3, 2025, 5:53:43 AMJan 3
to vim/vim, Subscribed

@dkearns

I added abstract to the exclude_list just like class and enum.
This way, abstract will not be added to the "syn keyword vimCommand" in the auto-generated part of vim.vim.
https://github.com/vim/vim/blob/aa979c763da2fa7ede2416a1ab8de7a46d88cd04/runtime/syntax/generator/gen_syntax_vim.vim#L251-L259

I believe this is the correct solution.
However, I think the following changes are necessary.
What do you think?
(I have confirmed that this change produces the same results as before for syntax tests)

diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 6a8e7adea..cb7f1dff9 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -241,7 +241,7 @@ syn case match
 
 " All vimCommands are contained by vimIsCommand. {{{2
 syn cluster vimCmdList	contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDef,vimDefFold,vimDelcommand,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimFuncFold,vimGlobal,vimHighlight,vimLet,vimLoadkeymap,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimSet,vimSleep,vimSyntax,vimThrow,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate,@vim9CmdList
-syn cluster vim9CmdList	contains=vim9Class,vim9Const,vim9Enum,vim9Export,vim9Final,vim9For,vim9Interface,vim9Type,vim9Var
+syn cluster vim9CmdList	contains=vim9Abstract,vim9Class,vim9Const,vim9Enum,vim9Export,vim9Final,vim9For,vim9Interface,vim9Type,vim9Var
 syn match vimCmdSep	"[:|]\+"	skipwhite nextgroup=@vimCmdList,vimSubst1
 syn match vimIsCommand	"\<\%(\h\w*\|[23]mat\%[ch]\)\>"	contains=vimCommand
 syn match vimBang	      contained	"!"


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16356/c2569038717@github.com>

h_east

unread,
Jan 3, 2025, 6:46:07 AMJan 3
to vim/vim, Subscribed

@chrisbra
I have made a PR for the fix. #16376


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16356/c2569099570@github.com>

Christian Brabandt

unread,
Jan 3, 2025, 11:35:11 AMJan 3
to vim/vim, Subscribed

thanks


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16356/c2569509221@github.com>

Reply all
Reply to author
Forward
0 new messages