Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
change syntax names to compatable with themes
close #50
  • Loading branch information
outsideris committed Jun 13, 2016
1 parent 8349bd5 commit 264d272
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
4 changes: 1 addition & 3 deletions grammars/angularjs.cson
Expand Up @@ -157,7 +157,7 @@
')))\\b\\s*(=?)'
'beginCaptures':
'1':
'name': 'entity.other.attribute-name.html.angular'
'name': 'support.other.attribute-name.html.angular'
'end': '(?<=\'|")|(?=\\s|>)'
'name': 'meta.attribute.html.angular'
'patterns': [
Expand All @@ -166,7 +166,6 @@
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.html.angular'
'contentName': 'meta.tag.template.angular'
'end': '"'
'endCaptures':
'0':
Expand All @@ -181,7 +180,6 @@
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.html.angular'
'contentName': 'meta.tag.template.angular'
'end': '\''
'endCaptures':
'0':
Expand Down
46 changes: 23 additions & 23 deletions spec/grammar-spec.coffee
Expand Up @@ -18,7 +18,7 @@ describe 'directive grammar', ->
<dd ng-repeat="availability in phone.availability">{{availability}}</dd>
'''

expect(lines[0][3]).toEqual value: 'ng-repeat', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[0][3]).toEqual value: 'ng-repeat', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']

it 'tokenizes ng-src and ng-click attributes inside HTML', ->
lines = grammar.tokenizeLines '''
Expand All @@ -27,52 +27,52 @@ describe 'directive grammar', ->
</li>
'''

expect(lines[0][3]).toEqual value: 'ng-repeat', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[1][4]).toEqual value: 'ng-src', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[1][12]).toEqual value: 'ng-click', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[0][3]).toEqual value: 'ng-repeat', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']
expect(lines[1][4]).toEqual value: 'ng-src', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']
expect(lines[1][12]).toEqual value: 'ng-click', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']

it 'tokenizes ng-view attribute without value inside HTML', ->
lines = grammar.tokenizeLines '''
<div ng-view class="view-frame"></div>
'''

expect(lines[0][3]).toEqual value: 'ng-view', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[0][3]).toEqual value: 'ng-view', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']

it 'tokenizes capitalized ng-repeat attribute inside HTML', ->
lines = grammar.tokenizeLines '''
<dd NG-REPEAT="availability in phone.availability">{{availability}}</dd>
'''

expect(lines[0][3]).toEqual value: 'NG-REPEAT', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[0][3]).toEqual value: 'NG-REPEAT', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']

it 'tokenizes ng-repeat-start and ng-repeat-end attribute', ->
lines = grammar.tokenizeLines '''
<div ng-repeat-start></div>
<div ng-repeat-end></div>
'''

expect(lines[0][3]).toEqual value: 'ng-repeat-start', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[1][3]).toEqual value: 'ng-repeat-end', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[0][3]).toEqual value: 'ng-repeat-start', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']
expect(lines[1][3]).toEqual value: 'ng-repeat-end', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']

it 'tokenizes ng-controller attribute in body tag', ->
lines = grammar.tokenizeLines '''
<body ng-controller="TestCtrl">
'''

expect(lines[0][3]).toEqual value: 'ng-controller', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[0][3]).toEqual value: 'ng-controller', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']

it 'tokenizes ng-s attribute', ->
lines = grammar.tokenizeLines '''
<select ng-options="color.name group by color.shade for color in colors">
'''

expect(lines[0][3]).toEqual value: 'ng-options', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[0][3]).toEqual value: 'ng-options', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']

it 'tokenizes ng- attributes for anchor tags', ->
lines = grammar.tokenizeLines '''
<a href="/url" ng-click='{{setImage(img)}}'>
'''
expect(lines[0][9]).toEqual value: 'ng-click', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[0][9]).toEqual value: 'ng-click', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']

describe 'directive element', ->
it 'tokenizes ng-include element inside HTML', ->
Expand All @@ -97,28 +97,28 @@ describe 'directive grammar', ->
<body data-ng-controller="TestCtrl">
'''

expect(lines[0][3]).toEqual value: 'data-ng-controller', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[0][3]).toEqual value: 'data-ng-controller', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']

it 'tokenizes x- prefixed angular attributes', ->
lines = grammar.tokenizeLines '''
<body x-ng-controller="TestCtrl">
'''

expect(lines[0][3]).toEqual value: 'x-ng-controller', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[0][3]).toEqual value: 'x-ng-controller', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']

it 'tokenizes _ suffixed angular attributes', ->
lines = grammar.tokenizeLines '''
<body ng_controller="TestCtrl">
'''

expect(lines[0][3]).toEqual value: 'ng_controller', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[0][3]).toEqual value: 'ng_controller', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']

it 'tokenizes : suffixed angular attributes', ->
lines = grammar.tokenizeLines '''
<body ng:controller="TestCtrl">
'''

expect(lines[0][3]).toEqual value: 'ng:controller', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
expect(lines[0][3]).toEqual value: 'ng:controller', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'support.other.attribute-name.html.angular']

it 'tokenizes data- prefixed angular element', ->
lines = grammar.tokenizeLines '''
Expand Down Expand Up @@ -168,7 +168,7 @@ describe 'directive grammar', ->
'''

expect(lines[0][5]).toEqual value: '"', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'punctuation.definition.string.begin.html.angular']
expect(lines[0][6]).toEqual value: 'phone in phones | filter:query | orderBy:orderProp', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular']
expect(lines[0][6]).toEqual value: 'phone in phones | filter:query | orderBy:orderProp', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular']
expect(lines[0][7]).toEqual value: '"', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'punctuation.definition.string.end.html.angular']

it 'tokenizes angular expressions in value of attributes with single quoted', ->
Expand All @@ -177,7 +177,7 @@ describe 'directive grammar', ->
'''

expect(lines[0][5]).toEqual value: '\'', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.single.html.angular', 'punctuation.definition.string.begin.html.angular']
expect(lines[0][6]).toEqual value: 'img in phone.images', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.single.html.angular', 'meta.tag.template.angular']
expect(lines[0][6]).toEqual value: 'img in phone.images', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.single.html.angular']
expect(lines[0][7]).toEqual value: '\'', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.single.html.angular', 'punctuation.definition.string.end.html.angular']

it 'tokenizes angular expressions in value of attributes with {{}}', ->
Expand All @@ -186,14 +186,14 @@ describe 'directive grammar', ->
'''

expect(lines[0][5]).toEqual value: '"', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'punctuation.definition.string.begin.html.angular']
expect(lines[0][6]).toEqual value: '{{', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular', 'meta.tag.template.angular', 'punctuation.definition.block.begin.angular']
expect(lines[0][7]).toEqual value: 'img', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular', 'meta.tag.template.angular']
expect(lines[0][8]).toEqual value: '}}', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular', 'meta.tag.template.angular', 'punctuation.definition.block.end.angular']
expect(lines[0][6]).toEqual value: '{{', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular', 'punctuation.definition.block.begin.angular']
expect(lines[0][7]).toEqual value: 'img', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular']
expect(lines[0][8]).toEqual value: '}}', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular', 'punctuation.definition.block.end.angular']
expect(lines[0][9]).toEqual value: '"', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'punctuation.definition.string.end.html.angular']
expect(lines[0][13]).toEqual value: '"', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'punctuation.definition.string.begin.html.angular']
expect(lines[0][14]).toEqual value: '{{', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular', 'meta.tag.template.angular', 'punctuation.definition.block.begin.angular']
expect(lines[0][15]).toEqual value: 'setImage(img)', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular', 'meta.tag.template.angular']
expect(lines[0][16]).toEqual value: '}}', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular', 'meta.tag.template.angular', 'punctuation.definition.block.end.angular']
expect(lines[0][14]).toEqual value: '{{', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular', 'punctuation.definition.block.begin.angular']
expect(lines[0][15]).toEqual value: 'setImage(img)', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular']
expect(lines[0][16]).toEqual value: '}}', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular', 'punctuation.definition.block.end.angular']
expect(lines[0][17]).toEqual value: '"', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'punctuation.definition.string.end.html.angular']

describe 'angular ng-template', ->
Expand Down

0 comments on commit 264d272

Please sign in to comment.