forked from aniani/vim
		
	- 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>
		
			
				
	
	
		
			59 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			VimL
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			VimL
		
	
	
	
	
	
| vim9script
 | |
| 
 | |
| # VIM_TEST_SETUP hi link vim9MethodName Special
 | |
| # VIM_TEST_SETUP hi link vim9This Todo
 | |
| 
 | |
| 
 | |
| # Vim |builtin-object-methods| and namesake builtin functions.
 | |
| class PairClassTest
 | |
| 	public const a: any
 | |
| 	public const b: any
 | |
| 
 | |
| 	def new(a: any, b: any)
 | |
| 		this.a = a
 | |
| 		this.b = b
 | |
| 	enddef
 | |
| 
 | |
| 	def empty(): bool
 | |
| 		return false
 | |
| 	enddef
 | |
| 	def len(): number
 | |
| 		return 2
 | |
| 	enddef
 | |
| 	def string(): string
 | |
| 		return printf('(%s, %s)', this.a, this.b)
 | |
| 	enddef
 | |
| endclass
 | |
| 
 | |
| enum MarkerEnumTest
 | |
| 	INSTANCE
 | |
| 
 | |
| 	def NoOp()
 | |
| 	enddef
 | |
| 
 | |
| 	def empty(): bool
 | |
| 		return true
 | |
| 	enddef
 | |
| 	def len(): number
 | |
| 		return 0
 | |
| 	enddef
 | |
| 	def string(): string
 | |
| 		return this.name
 | |
| 	enddef
 | |
| endenum
 | |
| 
 | |
| const b1: bool = empty(MarkerEnumTest.INSTANCE)
 | |
| const n1: number = len(MarkerEnumTest.INSTANCE)
 | |
| const s1: string = string(MarkerEnumTest.INSTANCE)
 | |
| echo b1 && MarkerEnumTest.INSTANCE.empty()
 | |
| echo n1 == 0 && MarkerEnumTest.INSTANCE.len() == 0
 | |
| echo s1 == 'INSTANCE' && MarkerEnumTest.INSTANCE.string() == 'INSTANCE'
 | |
| 
 | |
| const pair: PairClassTest = PairClassTest.new(0, 1)
 | |
| const b2: bool = !pair.empty()
 | |
| const n2: number = pair.len()
 | |
| const s2: string = pair.string()
 | |
| echo b2 && !empty(pair)
 | |
| echo n2 == 2 && len(pair) == 2
 | |
| echo s2 == '(0, 1)' && string(pair) == '(0, 1)'
 |