From 1f46cfafa7ddf7e849f73e2472c558004b83f22c Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Sat, 5 Sep 2015 13:31:17 +0200 Subject: [PATCH] New JSX language under JavaScript group A specific grammar is needed to highlight .jsx files Thus, there are now in a distinct language but still in the JavaScript group --- .gitmodules | 3 +++ grammars.yml | 3 +++ lib/linguist/languages.yml | 9 ++++++++- samples/JSX/sample.jsx | 23 +++++++++++++++++++++++ vendor/grammars/language-babel | 1 + 5 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 samples/JSX/sample.jsx create mode 160000 vendor/grammars/language-babel diff --git a/.gitmodules b/.gitmodules index 5f07d011..87654b7e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -677,3 +677,6 @@ [submodule "vendor/grammars/X10"] path = vendor/grammars/X10 url = git@github.com:x10-lang/x10-highlighting.git +[submodule "vendor/grammars/language-babel"] + path = vendor/grammars/language-babel + url = https://github.com/gandm/language-babel diff --git a/grammars.yml b/grammars.yml index 42be3967..2a7a89e2 100644 --- a/grammars.yml +++ b/grammars.yml @@ -314,6 +314,9 @@ vendor/grammars/json.tmbundle: - source.json vendor/grammars/kotlin-sublime-package: - source.Kotlin +vendor/grammars/language-babel/: +- source.js.jsx +- source.regexp.babel vendor/grammars/language-clojure: - source.clojure vendor/grammars/language-coffee-script: diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index b2d75fa1..7be29046 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1575,6 +1575,14 @@ JSONiq: - .jq tm_scope: source.jq +JSX: + type: programming + group: JavaScript + extensions: + - .jsx + tm_scope: source.js.jsx + ace_mode: javascript + Jade: group: HTML type: markup @@ -1628,7 +1636,6 @@ JavaScript: - .jsfl - .jsm - .jss - - .jsx - .njs - .pac - .sjs diff --git a/samples/JSX/sample.jsx b/samples/JSX/sample.jsx new file mode 100644 index 00000000..2020618d --- /dev/null +++ b/samples/JSX/sample.jsx @@ -0,0 +1,23 @@ +'use strict'; + +const React = require('react') + +module.exports = React.createClass({ + render: function() { + let {feeds, log} = this.props; + + log.info(feeds); + return
+

News Feed's

+ +
; + } +}); diff --git a/vendor/grammars/language-babel b/vendor/grammars/language-babel new file mode 160000 index 00000000..c79ac897 --- /dev/null +++ b/vendor/grammars/language-babel @@ -0,0 +1 @@ +Subproject commit c79ac8979cff724e7db8933044f00b975dc4f277