Skip to content

Commit

Permalink
Scala case classes params highlight fixed, closes #956
Browse files Browse the repository at this point in the history
  • Loading branch information
Sannis committed Oct 19, 2015
1 parent ffbc2c9 commit 2974ead
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -8,6 +8,7 @@ New languages:
Notable fixes and improvements to existing languages:

- Added `abstract` and `namespace` keywords to TypeScript.
- Scala case classes params highlight fixed

Other notable changes:

Expand Down
17 changes: 15 additions & 2 deletions src/languages/scala.js
Expand Up @@ -37,8 +37,21 @@ function(hljs) {
var CLASS = {
className: 'class',
beginKeywords: 'class object trait type',
end: /[:={\[(\n;]/,
contains: [{className: 'keyword', beginKeywords: 'extends with', relevance: 10}, NAME]
end: /[:={\[\n;]/,
excludeEnd: true,
contains: [
{
beginKeywords: 'extends with',
relevance: 10
},
{
'className': 'params',
'begin': /\(/,
'end': /\)/,
relevance: 0
},
NAME
]
};

var METHOD = {
Expand Down
3 changes: 3 additions & 0 deletions test/markup/scala/case-classes.expect.txt
@@ -0,0 +1,3 @@
<span class="hljs-keyword">abstract</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Vertical</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">CaseJeu</span></span>
<span class="hljs-keyword">case</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Haut</span><span class="hljs-params">(name: String)</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Vertical</span></span>
<span class="hljs-keyword">case</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bas</span><span class="hljs-params">(name: String)</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Vertical</span></span>
3 changes: 3 additions & 0 deletions test/markup/scala/case-classes.txt
@@ -0,0 +1,3 @@
abstract class Vertical extends CaseJeu
case class Haut(name: String) extends Vertical
case class Bas(name: String) extends Vertical

0 comments on commit 2974ead

Please sign in to comment.