Merge pull request #265 from Microsoft/updateGrammarScript

Use build script to generate grammars
This commit is contained in:
Sheetal Nandi 2016-09-20 15:56:09 -07:00 коммит произвёл GitHub
Родитель 3e0e15ee6c b13a404624
Коммит 066bddd73f
16 изменённых файлов: 9362 добавлений и 10470 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -1,3 +1,6 @@
build/node_modules
build/typings/
build/*.js
tests/generated/*
tests/node_modules
tests/typings/

Просмотреть файл

@ -5,14 +5,27 @@ This repository contains TmLanguage files that are consumed by TypeScript editor
# Contributing
The XML files are generated from the YAML files, so contributors should hand-modify the YAML files, and XML files should only be generated by the [AAAPackageDev](https://github.com/SublimeText/AAAPackageDev) plugin.
The XML files are generated from the YAML files, so contributors should hand-modify the YAML files, and XML files should only be generated by running build script.
## Build
Update the XML files from within the ```build``` folder
``` sh
cd build
npm install # Installs dependencies required for building
npm start # Compiles & builds the XML files
```
## Tests
Test are run from within the ```tests``` folder
Test are run from within the ```tests``` folder and depend on build to make sure XML files are upto date
``` sh
cd tests
cd build
npm install # Installs dependencies required for building
cd ../tests
npm install # Installs dependencies required for testing
npm test # Compiles & runs tests
```

53
TypeScript.YAML-tmTheme Normal file
Просмотреть файл

@ -0,0 +1,53 @@
# VS theme settings for TypeScript
---
name: TypeScript
uuid: ef98eb90-bf9b-11e4-bb52-0800200c9a66
settings:
- scope: storage.modifier, storage.type, keyword.control, keyword.other.ts, keyword.generator.asterisk, punctuation.definition.template-expression
settings: { vsclassificationtype: keyword }
- scope: keyword.operator.new.ts, keyword.operator.delete.ts, keyword.operator.in.ts, keyword.operator.of.ts, keyword.operator.instanceof.ts, keyword.operator.typeof.ts, keyword.operator.void.ts, keyword.control.as.ts, keyword.operator.is.ts
settings: { vsclassificationtype: keyword }
- scope: support.type, constant.language, variable.language
settings: { vsclassificationtype: keyword }
- scope: string, punctuation.definition.string, constant.character
settings: { vsclassificationtype: string }
- scope: keyword.control.anchor.regexp, keyword.other.back-reference.regexp, keyword.operator.quantifier.regexp, keyword.operator.or.regexp, keyword.operator.negation.regexp, punctuation.definition.group.regexp, punctuation.definition.group.assertion.regexp, meta.assertion.look-ahead.regexp, meta.assertion.negative-look-ahead.regexp, punctuation.definition.group.capture.regexp, punctuation.definition.character-class.regexp, constant.other.character-class.range.regexp
settings: { vsclassificationtype: string }
- scope: constant.numeric, meta.delimiter.decimal.period.ts, constant.language.nan.ts, constant.language.infinity.ts
settings: { vsclassificationtype: number }
- scope: keyword.operator, storage.type.function.arrow.ts
settings: { vsclassificationtype: operator }
- scope: meta.brace.angle.ts, meta.brace.round.ts, meta.brace.square.ts, punctuation, constant.language.import-export-all.ts, meta.delimiter.object.comma.ts
settings: { vsclassificationtype: punctuation }
- scope: comment, comment.block.ts, comment.line.double-slash.ts, punctuation.definition.comment.ts
settings: { vsclassificationtype: comment }
- scope: comment.block.documentation.ts, other.meta.jsdoc, other.description.jsdoc
settings: { vsclassificationtype: comment }
- scope: entity.name.type.instance.jsdoc, variable.other.jsdoc
settings: { vsclassificationtype: identifier }
- scope: storage.type.class.jsdoc
settings: { vsclassificationtype: xml doc comment - name }
- scope: entity.name.class.ts
settings: { vsclassificationtype: class name }
- scope: entity.name.type.module.ts
settings: { vsclassificationtype: module name }
- scope: entity.name.type.enum.ts
settings: { vsclassificationtype: enum name }
- scope: entity.name.function, entity.name.type, meta.template.expression.ts, variable, entity.other.inherited-class.ts
settings: { vsclassificationtype: identifier }
- scope: constant.language.undefined.ts
settings: { vsclassificationtype: identifier }
...

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,176 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>TypeScript</string>
<key>settings</key>
<array>
<dict>
<key>scope</key>
<string>storage.modifier, storage.type, keyword.control, keyword.other.ts, keyword.generator.asterisk, punctuation.definition.template-expression</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.operator.new.ts, keyword.operator.delete.ts, keyword.operator.in.ts, keyword.operator.of.ts, keyword.operator.instanceof.ts, keyword.operator.typeof.ts, keyword.operator.void.ts, keyword.control.as.ts, keyword.operator.is.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>support.type, constant.language, variable.language</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>string, punctuation.definition.string, constant.character</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>string</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.control.anchor.regexp, keyword.other.back-reference.regexp, keyword.operator.quantifier.regexp, keyword.operator.or.regexp, keyword.operator.negation.regexp, punctuation.definition.group.regexp, punctuation.definition.group.assertion.regexp, meta.assertion.look-ahead.regexp, meta.assertion.negative-look-ahead.regexp, punctuation.definition.group.capture.regexp, punctuation.definition.character-class.regexp, constant.other.character-class.range.regexp</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>string</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>constant.numeric, meta.delimiter.decimal.period.ts, constant.language.nan.ts, constant.language.infinity.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>number</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.operator, storage.type.function.arrow.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>operator</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>meta.brace.angle.ts, meta.brace.round.ts, meta.brace.square.ts, punctuation, constant.language.import-export-all.ts, meta.delimiter.object.comma.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>punctuation</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>comment, comment.block.ts, comment.line.double-slash.ts, punctuation.definition.comment.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>comment</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>comment.block.documentation.ts, other.meta.jsdoc, other.description.jsdoc</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>comment</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.type.instance.jsdoc, variable.other.jsdoc</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>storage.type.class.jsdoc</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>xml doc comment - name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.class.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>class name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.type.module.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>module name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.type.enum.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>enum name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.function, entity.name.type, meta.template.expression.ts, variable, entity.other.inherited-class.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>constant.language.undefined.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
</array>
<key>uuid</key>
<string>ef98eb90-bf9b-11e4-bb52-0800200c9a66</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>TypeScript</string>
<key>uuid</key>
<string>ef98eb90-bf9b-11e4-bb52-0800200c9a66</string>
<key>settings</key>
<array>
<dict>
<key>scope</key>
<string>storage.modifier, storage.type, keyword.control, keyword.other.ts, keyword.generator.asterisk, punctuation.definition.template-expression</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.operator.new.ts, keyword.operator.delete.ts, keyword.operator.in.ts, keyword.operator.of.ts, keyword.operator.instanceof.ts, keyword.operator.typeof.ts, keyword.operator.void.ts, keyword.control.as.ts, keyword.operator.is.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>support.type, constant.language, variable.language</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>string, punctuation.definition.string, constant.character</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>string</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.control.anchor.regexp, keyword.other.back-reference.regexp, keyword.operator.quantifier.regexp, keyword.operator.or.regexp, keyword.operator.negation.regexp, punctuation.definition.group.regexp, punctuation.definition.group.assertion.regexp, meta.assertion.look-ahead.regexp, meta.assertion.negative-look-ahead.regexp, punctuation.definition.group.capture.regexp, punctuation.definition.character-class.regexp, constant.other.character-class.range.regexp</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>string</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>constant.numeric, meta.delimiter.decimal.period.ts, constant.language.nan.ts, constant.language.infinity.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>number</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.operator, storage.type.function.arrow.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>operator</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>meta.brace.angle.ts, meta.brace.round.ts, meta.brace.square.ts, punctuation, constant.language.import-export-all.ts, meta.delimiter.object.comma.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>punctuation</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>comment, comment.block.ts, comment.line.double-slash.ts, punctuation.definition.comment.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>comment</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>comment.block.documentation.ts, other.meta.jsdoc, other.description.jsdoc</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>comment</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.type.instance.jsdoc, variable.other.jsdoc</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>storage.type.class.jsdoc</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>xml doc comment - name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.class.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>class name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.type.module.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>module name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.type.enum.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>enum name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.function, entity.name.type, meta.template.expression.ts, variable, entity.other.inherited-class.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>constant.language.undefined.ts</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
</array>
</dict>
</plist>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,28 @@
# VS theme settings for TypeScriptReact
# These only contains additions to existing TypeScript theme
---
name: TypeScriptReact
uuid: ef98eb90-bf9b-11e4-bb52-0800200c9a66
settings:
# Additions
- scope: entity.name.tag.tsx
settings: { vsclassificationtype: xml literal - name }
- scope: entity.other.attribute-name.tsx
settings: { vsclassificationtype: xml literal - attribute name }
# scope: meta.tag.tsx string.quoted, meta.tag.tsx string.quoted punctuation.definition.string, meta.tag.tsx string.quoted constant.character.entity.tsx, meta.tag.tsx string.quoted constant.character.entity.tsx punctuation.definition.entity.tsx
# settings: { vsclassificationtype: xml literal - attribute value }
- scope: string.jsxAttributeValue, punctuation.definition.string.jsxAttributeValue, constant.character.entity.jsxAttributeValue.tsx, punctuation.definition.entity.jsxAttributeValue.tsx, invalid.illegal.bad-ampersand.jsxAttributeValue.tsx
settings: { vsclassificationtype: xml literal - attribute value }
- scope: meta.jsx.children.tsx, constant.character.entity.tsx, punctuation.definition.entity.tsx, invalid.illegal.bad-ampersand.tsx
settings: { vsclassificationtype: xml literal - text }
- scope: invalid.illegal.attribute.tsx, meta.brace.curly.tsx
settings: { vsclassificationtype: identifier }
...

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,235 +1,211 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>TypeScript</string>
<key>settings</key>
<array>
<dict>
<key>scope</key>
<string>storage.modifier, storage.type, keyword.control, keyword.other.tsx, keyword.generator.asterisk, punctuation.definition.template-expression</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.operator.new.tsx, keyword.operator.delete.tsx, keyword.operator.in.tsx, keyword.operator.of.tsx, keyword.operator.instanceof.tsx, keyword.operator.typeof.tsx, keyword.operator.void.tsx, keyword.control.as.tsx, keyword.operator.is.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>support.type, constant.language, variable.language</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>string, punctuation.definition.string, constant.character</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>string</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.control.anchor.regexp, keyword.other.back-reference.regexp, keyword.operator.quantifier.regexp, keyword.operator.or.regexp, keyword.operator.negation.regexp, punctuation.definition.group.regexp, punctuation.definition.group.assertion.regexp, meta.assertion.look-ahead.regexp, meta.assertion.negative-look-ahead.regexp, punctuation.definition.group.capture.regexp, punctuation.definition.character-class.regexp, constant.other.character-class.range.regexp</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>string</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>constant.numeric, meta.delimiter.decimal.period.tsx, constant.language.nan.tsx, constant.language.infinity.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>number</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.operator, storage.type.function.arrow.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>operator</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>meta.brace.angle.tsx, meta.brace.round.tsx, meta.brace.square.tsx, punctuation, constant.language.import-export-all.tsx, meta.delimiter.object.comma.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>punctuation</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>comment, comment.block.tsx, comment.line.double-slash.tsx, punctuation.definition.comment.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>comment</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>comment.block.documentation.tsx, other.meta.jsdoc, other.description.jsdoc</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>comment</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.type.instance.jsdoc, variable.other.jsdoc</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>storage.type.class.jsdoc</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>xml doc comment - name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.class.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>class name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.type.module.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>module name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.type.enum.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>enum name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.tag.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>xml literal - name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.other.attribute-name.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>xml literal - attribute name</string>
</dict>
</dict>
<!--<dict>
<key>scope</key>
<string>meta.tag.tsx string.quoted, meta.tag.tsx string.quoted punctuation.definition.string, meta.tag.tsx string.quoted constant.character.entity.tsx, meta.tag.tsx string.quoted constant.character.entity.tsx punctuation.definition.entity.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>xml literal - attribute value</string>
</dict>
</dict>-->
<dict>
<key>scope</key>
<string>string.jsxAttributeValue, punctuation.definition.string.jsxAttributeValue, constant.character.entity.jsxAttributeValue.tsx, punctuation.definition.entity.jsxAttributeValue.tsx, invalid.illegal.bad-ampersand.jsxAttributeValue.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>xml literal - attribute value</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>meta.jsx.children.tsx, constant.character.entity.tsx, punctuation.definition.entity.tsx, invalid.illegal.bad-ampersand.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>xml literal - text</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>invalid.illegal.attribute.tsx, meta.brace.curly.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.function, entity.name.type, meta.template.expression.tsx, variable, entity.other.inherited-class.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>constant.language.undefined.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
</array>
<key>uuid</key>
<string>ef98eb90-bf9b-11e4-bb52-0800200c9a66</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>TypeScriptReact</string>
<key>uuid</key>
<string>ef98eb90-bf9b-11e4-bb52-0800200c9a66</string>
<key>settings</key>
<array>
<dict>
<key>scope</key>
<string>storage.modifier, storage.type, keyword.control, keyword.other.tsx, keyword.generator.asterisk, punctuation.definition.template-expression</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.operator.new.tsx, keyword.operator.delete.tsx, keyword.operator.in.tsx, keyword.operator.of.tsx, keyword.operator.instanceof.tsx, keyword.operator.typeof.tsx, keyword.operator.void.tsx, keyword.control.as.tsx, keyword.operator.is.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>support.type, constant.language, variable.language</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>string, punctuation.definition.string, constant.character</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>string</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.control.anchor.regexp, keyword.other.back-reference.regexp, keyword.operator.quantifier.regexp, keyword.operator.or.regexp, keyword.operator.negation.regexp, punctuation.definition.group.regexp, punctuation.definition.group.assertion.regexp, meta.assertion.look-ahead.regexp, meta.assertion.negative-look-ahead.regexp, punctuation.definition.group.capture.regexp, punctuation.definition.character-class.regexp, constant.other.character-class.range.regexp</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>string</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>constant.numeric, meta.delimiter.decimal.period.tsx, constant.language.nan.tsx, constant.language.infinity.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>number</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.operator, storage.type.function.arrow.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>operator</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>meta.brace.angle.tsx, meta.brace.round.tsx, meta.brace.square.tsx, punctuation, constant.language.import-export-all.tsx, meta.delimiter.object.comma.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>punctuation</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>comment, comment.block.tsx, comment.line.double-slash.tsx, punctuation.definition.comment.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>comment</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>comment.block.documentation.tsx, other.meta.jsdoc, other.description.jsdoc</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>comment</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.type.instance.jsdoc, variable.other.jsdoc</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>storage.type.class.jsdoc</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>xml doc comment - name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.class.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>class name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.type.module.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>module name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.type.enum.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>enum name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.function, entity.name.type, meta.template.expression.tsx, variable, entity.other.inherited-class.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>constant.language.undefined.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.name.tag.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>xml literal - name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>entity.other.attribute-name.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>xml literal - attribute name</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>string.jsxAttributeValue, punctuation.definition.string.jsxAttributeValue, constant.character.entity.jsxAttributeValue.tsx, punctuation.definition.entity.jsxAttributeValue.tsx, invalid.illegal.bad-ampersand.jsxAttributeValue.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>xml literal - attribute value</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>meta.jsx.children.tsx, constant.character.entity.tsx, punctuation.definition.entity.tsx, invalid.illegal.bad-ampersand.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>xml literal - text</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>invalid.illegal.attribute.tsx, meta.brace.curly.tsx</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>identifier</string>
</dict>
</dict>
</array>
</dict>
</plist>

Просмотреть файл

@ -8,7 +8,9 @@ install:
- node --version
- npm install -g npm@next
- npm --version
- cd tests
- cd build
- npm install
- cd ../tests
- npm install
- npm test

111
build/build.ts Normal file
Просмотреть файл

@ -0,0 +1,111 @@
import fs = require('fs');
import path = require('path');
import yaml = require('js-yaml');
import plist = require('plist');
function writePlistFile(grammar: any, fileName: string) {
const text = plist.build(grammar);
fs.writeFileSync(fileName, text, "utf8");
}
function readYaml(fileName: string) {
const text = fs.readFileSync(fileName, "utf8");
return yaml.safeLoad(text);
}
function changeTsToTsx(str: string) {
return str.replace(/\.ts/g, '.tsx');
}
function fixGrammarScopeNames(rule: any) {
if (typeof rule.name === 'string') {
rule.name = changeTsToTsx(rule.name);
}
for (var property in rule) {
var value = rule[property];
if (typeof value === 'object') {
fixGrammarScopeNames(value);
}
}
}
function changeTsToTsxGrammar(grammar: any) {
const tsxUpdates = readYaml("../TypeScriptReact.YAML-tmLanguage");
// Update name, file types, scope name and uuid
for (let key in tsxUpdates) {
if (key !== "repository") {
grammar[key] = tsxUpdates[key];
}
}
// Update scope names to .tsx
const repository = grammar.repository;
for (let key in repository) {
fixGrammarScopeNames(repository[key]);
}
// Add repository items
const updatesRepository = tsxUpdates.repository;
for (let key in updatesRepository) {
switch(key) {
case "statements":
case "expression":
// Update statements/expression
repository[key].patterns.unshift(updatesRepository[key].patterns[0]);
break;
default:
// Add jsx
repository[key] = updatesRepository[key];
}
}
return grammar;
}
function buildGrammar() {
const tsGrammar = readYaml("../TypeScript.YAML-tmLanguage");
// Write TypeScript.tmLanguage
writePlistFile(tsGrammar, "../TypeScript.tmLanguage");
// Write TypeScriptReact.tmLangauge
const tsxGrammar = changeTsToTsxGrammar(tsGrammar);
writePlistFile(tsxGrammar, "../TypeScriptReact.tmLanguage");
}
function changeTsToTsxTheme(theme: any) {
const tsxUpdates = readYaml("../TypeScriptReact.YAML-tmTheme");
// Update name, uuid
for (let key in tsxUpdates) {
if (key !== "settings") {
theme[key] = tsxUpdates[key];
}
}
// Update scope names to .tsx
const settings = theme.settings;
for (let i = 0; i < settings.length; i++) {
settings[i].scope = changeTsToTsx(settings[i].scope);
}
// Add additional setting items
theme.settings = theme.settings.concat(tsxUpdates.settings);
return theme;
}
function buildTheme() {
const tsTheme = readYaml("../TypeScript.YAML-tmTheme");
// Write TypeScript.tmTheme
writePlistFile(tsTheme, "../TypeScript.tmTheme");
// Write TypeScriptReact.thTheme
const tsxTheme = changeTsToTsxTheme(tsTheme);
writePlistFile(tsxTheme, "../TypeScriptReact.tmTheme");
}
buildGrammar();
buildTheme();

3
build/index.d.ts поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
declare module "plist" {
export function build(json: any): string;
}

18
build/package.json Normal file
Просмотреть файл

@ -0,0 +1,18 @@
{
"name": "build",
"version": "1.0.0",
"private": true,
"description": "",
"main": "build.js",
"scripts": {
"postinstall": "npm start",
"start": "tsc && node ./build.js"
},
"dependencies": {
"@types/js-yaml": "^3.5.28",
"@types/node": "^6.0.39",
"js-yaml": "^3.6.1",
"plist": "^2.0.1",
"typescript": "^2.1.0-dev.20160920"
}
}

10
build/tsconfig.json Normal file
Просмотреть файл

@ -0,0 +1,10 @@
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"noImplicitAny": true
},
"exclude": [
"node_modules"
]
}

Просмотреть файл

@ -18,7 +18,7 @@ function foo() {
^
source.tsx meta.function.tsx
^^^
source.tsx meta.function.tsx entity.name.function.ts
source.tsx meta.function.tsx entity.name.function.tsx
^
source.tsx meta.function.tsx meta.parameters.tsx punctuation.definition.parameters.begin.tsx
^

Просмотреть файл

@ -6,7 +6,7 @@
"main": "test.ts",
"scripts": {
"postinstall": "tsd install",
"pretest": "tsc && node ./build.js",
"pretest": "node ../build/build.js && tsc && node ./build.js",
"test": "mocha test.js"
},
"dependencies": {
@ -18,4 +18,4 @@
"devDependencies": {
"tsd": "^0.6.5"
}
}
}