Skip to content

Commit f1ae3ab

Browse files
committed
fix(ruby) highlight entire class name even when it contains underscores
Signed-off-by: jimtng <[email protected]>
1 parent d301848 commit f1ae3ab

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## Version 11.11.2
2+
3+
Core Grammars:
4+
5+
- fix(ruby) highlight entire class name even when it contains underscores
6+
7+
18
## Version 11.11.1
29

310
- Fixes regression with Rust grammar.

src/languages/ruby.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export default function(hljs) {
1212
const RUBY_METHOD_RE = '([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)';
1313
// TODO: move concepts like CAMEL_CASE into `modes.js`
1414
const CLASS_NAME_RE = regex.either(
15-
/\b([A-Z]+[a-z0-9]+)+/,
15+
/\b([A-Z]+[a-z0-9_]+)+/,
1616
// ends in caps
17-
/\b([A-Z]+[a-z0-9]+)+[A-Z]+/,
17+
/\b([A-Z]+[a-z0-9_]+)+[A-Z]+/,
1818
)
1919
;
2020
const CLASS_NAME_WITH_NAMESPACE_RE = regex.concat(CLASS_NAME_RE, /(::\w+)*/)

0 commit comments

Comments
 (0)