Skip to content

Commit 3d7c0b4

Browse files
authored
Allow bitwise binary operators to be line wrapped (#213)
1 parent fc13405 commit 3d7c0b4

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

queries/gdscript.scm

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@
112112
[
113113
"+" "-" "*" "/" "%" "**"
114114
"==" "!=" "<" ">" "<=" ">=" "and"
115-
"or" "in" "is" "&&" "||" "not"]
115+
"or" "in" "is" "&&" "||" "not"
116+
"&" "|" "^" "<<" ">>"]
116117
@prepend_input_softline @append_input_softline)
117118
; Comparison operators (+ "as" keyword which needs the same spacing)
118119
[
@@ -121,10 +122,6 @@
121122
@prepend_space @append_space
122123
; not can be at the start of an expression, so we handle it separately - needs another query for the case "is not"
123124
"not" @append_space
124-
; Bitwise operators
125-
[
126-
"&" "|" "^" "<<" ">>"]
127-
@prepend_space @append_space
128125
; ~ is generally right next to the variable it operates on, so we don't add a space after it
129126
[
130127
"=" ":=" "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^=" "<<=" ">>="]

tests/expected/multiline.gd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,12 @@ func foo():
3636
],
3737
2,
3838
]
39+
40+
var sum = (1 +
41+
2
42+
)
43+
44+
var bitflags = (
45+
0x0b
46+
| 0xa0
47+
)

tests/input/multiline.gd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,12 @@ func foo():
4141
],
4242
2
4343
]
44+
45+
var sum = (1 +
46+
2
47+
)
48+
49+
var bitflags = (
50+
0x0b
51+
| 0xa0
52+
)

0 commit comments

Comments
 (0)