runtime(vim): Update base-syntax, improve variable matching
- Match variables after operators, including line continuations. - Match option variables without leading whitespace. - Explicitly match expression subscripts. - Match Vim9 variables in LHS of assignments and method calls. - Match option variables (&option) with a dedicated syntax group like environment variables. - Match list literals, fixes: #5830 - Match :{un}lockvar arguments. - Match registers and environment variables in :let unpack lists. - Match lambda expressions - Match Vim9 scope blocks - Match variables in :for subject - Highlight user variables with Normal - Improve this/super keyword matching, fixes: #15970 closes: #16476 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
54d7f18c38
commit
1aa287e048
63
runtime/syntax/testdir/input/vim9_super_this_keywords2.vim
Normal file
63
runtime/syntax/testdir/input/vim9_super_this_keywords2.vim
Normal file
@ -0,0 +1,63 @@
|
||||
vim9script
|
||||
|
||||
# VIM_TEST_SETUP hi link vim9Super Todo
|
||||
# VIM_TEST_SETUP hi link vim9This Todo
|
||||
# See: https://github.com/vim/vim/pull/16476#issuecomment-2638191110
|
||||
|
||||
|
||||
class A
|
||||
var _value: any
|
||||
|
||||
def new(value: any)
|
||||
this._BaseInit(value)
|
||||
enddef
|
||||
|
||||
def _BaseInit(value: any)
|
||||
this._value = value
|
||||
enddef
|
||||
|
||||
def Value(): any
|
||||
return this._value
|
||||
enddef
|
||||
endclass
|
||||
|
||||
class B extends A
|
||||
def new(value: number)
|
||||
super._BaseInit(value)
|
||||
enddef
|
||||
|
||||
def Value(): number
|
||||
echo this
|
||||
return super._value
|
||||
enddef
|
||||
endclass
|
||||
|
||||
class C extends A
|
||||
#### E117
|
||||
# def new(value: string)
|
||||
# super(value)
|
||||
# enddef
|
||||
|
||||
#### E1034
|
||||
# def new(super._value)
|
||||
# enddef
|
||||
|
||||
#### E1034
|
||||
# def new(value: string)
|
||||
# super._value = value
|
||||
# enddef
|
||||
|
||||
#### E1356
|
||||
# def Super(): A
|
||||
# return super
|
||||
# enddef
|
||||
|
||||
def This(): C
|
||||
return this
|
||||
enddef
|
||||
endclass
|
||||
|
||||
echo 1 == A.new(1).Value()
|
||||
echo 2 == B.new(2).Value()
|
||||
defcompile C
|
||||
|
||||
Reference in New Issue
Block a user