Commit 327071f
authored
Fix highlighting comparable method definition (#2149)
Previously, when trying to highlight the definition of the comparable
method (aka the spaceship, `<=>`), the `<` would be highlighted as
`Name::Function` but the `=>` would be `Operator`. This happens because
of the ordering of potential matches in the `funcname` regular
expression:
```ruby
%r(
# snip
<<? | >>? | <=>? # snip
)
```
The method name is always caught by the single `<` match, and so never
makes it to the `<=>` possibility.
This commit fixes the issue by trying to match `<=>?` before `<<?`. This
ensures it _can_ be matched, and since none of the following potential
matches are a superset of its (`<=>?`) matches it won't cause any issue
with subsequent possibilities.1 parent 3b461b1 commit 327071f
2 files changed
+15
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | | - | |
| 300 | + | |
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
92 | 106 | | |
93 | 107 | | |
94 | 108 | | |
| |||
0 commit comments