Skip to content

Commit

Permalink
enh(js/ts) improve CLASS_REFERENCE (#3411)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Dec 9, 2021
1 parent 84719c1 commit ba806ed
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -16,6 +16,7 @@ Grammars:
- enh(swift) add SE-0290 unavailability condition (#3382) [Bradley Mackey][]
- fix(fsharp) Highlight operators, match type names only in type annotations, support quoted identifiers, and other smaller fixes. [Melvyn Laïly][]
- enh(java) add `sealed` and `non-sealed` keywords (#3386) [Bradley Mackey][]
- enh(js/ts) improve `CLASS_REFERENCE` (#3411) [Josh Goebel][]
- enh(nsis) Update defines pattern to allow `!` (#3417) [idleberg][]
- enh(nsis) Update language strings pattern to allow `!` (#3420) [idleberg][]
- fix(clojure) Several issues with Clojure highlighting (#3397) [Björn Ebbinghaus][]
Expand Down
12 changes: 8 additions & 4 deletions src/languages/javascript.js
Expand Up @@ -290,10 +290,14 @@ export default function(hljs) {
regex.either(
// Hard coded exceptions
/\bJSON/,
// Float32Array
/\b[A-Z][a-z]+([A-Z][a-z]+|\d)*/,
// CSSFactory
/\b[A-Z]{2,}([A-Z][a-z]+|\d)+/,
// Float32Array, OutT
/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,
// CSSFactory, CSSFactoryT
/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*|\d)*/,
// FPs, FPsT
/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*|\d)*/,
// P
// single letters are not highlighted
// BLAH
// this will be flagged as a UPPER_CASE_CONSTANT instead
),
Expand Down
5 changes: 5 additions & 0 deletions test/markup/javascript/class.expect.txt
Expand Up @@ -33,3 +33,8 @@
<span class="hljs-title class_">CSSParser</span>
<span class="hljs-title class_">Float32Array</span>
<span class="hljs-title class_">BigInt64Array</span>
<span class="hljs-title class_">FPs</span>
<span class="hljs-title class_">OutT</span>
<span class="hljs-title class_">InT</span>
<span class="hljs-title class_">CSSParserT</span>
<span class="hljs-title class_">IResponseTsS</span>
5 changes: 5 additions & 0 deletions test/markup/javascript/class.txt
Expand Up @@ -33,3 +33,8 @@ SelfDrivingTruck
CSSParser
Float32Array
BigInt64Array
FPs
OutT
InT
CSSParserT
IResponseTsS

0 comments on commit ba806ed

Please sign in to comment.