mirror of
https://github.com/HiPhish/rainbow-delimiters.nvim.git
synced 2024-09-16 14:24:05 +02:00
Improve Vim script query
This commit is contained in:
parent
a2072fef01
commit
fffe2d9070
3 changed files with 101 additions and 7 deletions
|
@ -9,6 +9,16 @@ is based on `Keep a Changelog`_ and this project adheres to `Semantic
|
|||
Versioning`_.
|
||||
|
||||
|
||||
Unreleased
|
||||
##########
|
||||
|
||||
Fixed
|
||||
=====
|
||||
|
||||
- Make a better effort to make parentheses in Vim scrip expressions work (there
|
||||
is only so much that can be done though)
|
||||
|
||||
|
||||
[0.6.1] - 2024-08-11
|
||||
####################
|
||||
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
;;; an expression like (((3))) does not have three levels of nesting, but only
|
||||
;;; one. All the parentheses and the integer literal are on the same level.
|
||||
;;; This makes it impossible to apply alternating highlights.
|
||||
;;;
|
||||
;;; For some of the patterns it is possible to make a best effort by specifying
|
||||
;;; multiple mutually exclusive variants.
|
||||
|
||||
(list
|
||||
"[" @delimiter
|
||||
"]" @delimiter @sentinel) @container
|
||||
|
@ -9,7 +13,7 @@
|
|||
(dictionnary ;; this is no typo, "dictionary" is misspelled in the parser
|
||||
"{" @delimiter
|
||||
(dictionnary_entry
|
||||
":" @delimiter)
|
||||
":" @delimiter)?
|
||||
"}" @delimiter @sentinel) @container
|
||||
|
||||
(call_expression
|
||||
|
@ -20,10 +24,80 @@
|
|||
"(" @delimiter
|
||||
")" @delimiter @sentinel) @container
|
||||
|
||||
|
||||
;;; ---------------------------------------------------------------------------
|
||||
(binary_operation
|
||||
"(" @delimiter
|
||||
")" @delimiter @sentinel) @container
|
||||
left: ("(" @delimiter
|
||||
")" @delimiter)
|
||||
right: ("(" @delimiter
|
||||
")" @delimiter @sentinel)) @container
|
||||
|
||||
(binary_operation
|
||||
left: _ @_left
|
||||
(#not-eq? @_left "(")
|
||||
right: ("(" @delimiter
|
||||
")" @delimiter @sentinel)) @container
|
||||
|
||||
(binary_operation
|
||||
left: ("(" @delimiter
|
||||
")" @delimiter @sentinel)
|
||||
right: _ @_right
|
||||
(#not-eq? @_right "(")) @container
|
||||
|
||||
|
||||
;;; ---------------------------------------------------------------------------
|
||||
(ternary_expression
|
||||
condition: ("(" @delimiter
|
||||
")" @delimiter)
|
||||
left: ("(" @delimiter
|
||||
")" @delimiter)
|
||||
right: ("(" @delimiter
|
||||
")" @delimiter @sentinel)) @container
|
||||
|
||||
(ternary_expression
|
||||
"(" @delimiter
|
||||
")" @delimiter @sentinel) @container
|
||||
condition: _ @_condition
|
||||
(#not-eq? @_condition "(")
|
||||
left: ("(" @delimiter
|
||||
")" @delimiter)
|
||||
right: ("(" @delimiter
|
||||
")" @delimiter @sentinel)) @container
|
||||
|
||||
(ternary_expression
|
||||
condition: ("(" @delimiter
|
||||
")" @delimiter)
|
||||
left: _ @_left
|
||||
(#not-eq? @_left "(")
|
||||
right: ("(" @delimiter
|
||||
")" @delimiter @sentinel)) @container
|
||||
|
||||
(ternary_expression
|
||||
condition: ("(" @delimiter
|
||||
")" @delimiter)
|
||||
left: ("(" @delimiter
|
||||
")" @delimiter @sentinel)
|
||||
right: _ @_right
|
||||
(#not-eq? @_right "(")) @container
|
||||
|
||||
(ternary_expression
|
||||
condition: ("(" @delimiter
|
||||
")" @delimiter @sentinel)
|
||||
left: _ @_left
|
||||
(#not-eq? @_left "(")
|
||||
right: _ @_right
|
||||
(#not-eq? @_right "(")) @container
|
||||
|
||||
(ternary_expression
|
||||
condition: _ @_condition
|
||||
(#not-eq? @_condition "(")
|
||||
left: ("(" @delimiter
|
||||
")" @delimiter @sentinel)
|
||||
right: _ @_right
|
||||
(#not-eq? @_right "(")) @container
|
||||
|
||||
(ternary_expression
|
||||
condition: _ @_condition
|
||||
(#not-eq? @_condition "(")
|
||||
left: _ @_left
|
||||
(#not-eq? @_left "(")
|
||||
right: ("(" @delimiter
|
||||
")" @delimiter @sentinel)) @container
|
||||
|
|
|
@ -7,8 +7,18 @@ let g:my_dict = {
|
|||
\}
|
||||
\ }
|
||||
|
||||
echo string(1 + (2 + (3 + 4)))
|
||||
echo string(1 + (2 + (3 + (4))))
|
||||
echo string(-(3))
|
||||
echo string((5)-(3))
|
||||
echo string((5) - (3))
|
||||
echo string(5 - (3))
|
||||
echo string((5) - 3)
|
||||
|
||||
echo string((1) ? (2) : (3))
|
||||
echo string( 1 ? (2) : (3))
|
||||
echo string((1) ? 2 : (3))
|
||||
echo string((1) ? (2) : 3 )
|
||||
echo string((1) ? 2 : 3 )
|
||||
echo string( 1 ? (2) : 3 )
|
||||
echo string( 1 ? 2 : (3))
|
||||
|
||||
echo ((('Hello, world!')))
|
||||
|
|
Loading…
Reference in a new issue