From 410fe2843dc5281067c413bafe678d87f38f45cd Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Wed, 17 Dec 2014 15:55:16 -0500 Subject: [PATCH 1/5] Add some tests for grammars.yml It must be sorted, because it will get re-sorted when script/download-grammars is next run and that would clutter up diffs. And it must not contain any duplicate scopes. --- test/test_grammars.rb | 13 +++++++++++++ test/test_pedantic.rb | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100644 test/test_grammars.rb diff --git a/test/test_grammars.rb b/test/test_grammars.rb new file mode 100644 index 00000000..96fdb667 --- /dev/null +++ b/test/test_grammars.rb @@ -0,0 +1,13 @@ +require_relative "./helper" + +class TestGrammars < Test::Unit::TestCase + def setup + @grammars = YAML.load(File.read(File.expand_path("../../grammars.yml", __FILE__))) + end + + def test_no_duplicate_scopes + scopes = @grammars.values.flatten + duplicates = scopes.group_by { |s| s }.select { |k, v| v.length > 1 }.map(&:first) + assert duplicates.empty?, "The following scopes appear in grammars.yml more than once:\n#{duplicates.sort.join("\n")}" + end +end diff --git a/test/test_pedantic.rb b/test/test_pedantic.rb index be8ce063..9e35a8f2 100644 --- a/test/test_pedantic.rb +++ b/test/test_pedantic.rb @@ -3,6 +3,7 @@ require_relative "./helper" class TestPedantic < Test::Unit::TestCase filename = File.expand_path("../../lib/linguist/languages.yml", __FILE__) LANGUAGES = YAML.load(File.read(filename)) + GRAMMARS = YAML.load(File.read(File.expand_path("../../grammars.yml", __FILE__))) def test_language_names_are_sorted assert_sorted LANGUAGES.keys @@ -21,6 +22,16 @@ class TestPedantic < Test::Unit::TestCase end end + def test_grammars_are_sorted + assert_sorted GRAMMARS.keys + end + + def test_scopes_are_sorted + GRAMMARS.values.each do |scopes| + assert_sorted scopes + end + end + def assert_sorted(list) list.each_cons(2) do |previous, item| flunk "#{previous} should come after #{item}" if previous > item From e98223b2b375efd29d0df6dc585c854c5d0d4d84 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Wed, 17 Dec 2014 16:07:42 -0500 Subject: [PATCH 2/5] Use raw links as little as possible It's much cleaner and more robust to specify the repo URL instead of a URL to an individual file. If the file gets moved we'll still be able to find it if we're using the repo URL. Where we do need raw links, we now use github.com/owner/repo/raw/* because it looks a bit nicer and sorts better with non-raw links. --- grammars.yml | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/grammars.yml b/grammars.yml index fc1d510f..49292343 100644 --- a/grammars.yml +++ b/grammars.yml @@ -26,13 +26,13 @@ https://github.com/AlanQuatermain/go-tmbundle: - source.go https://github.com/Anomareh/PHP-Twig.tmbundle: - text.html.twig -https://github.com/Cirru/sublime-cirru/raw/master/Cirru.tmLanguage: +https://github.com/Cirru/sublime-cirru: - source.cirru https://github.com/Cykey/Sublime-Logos: - source.logos -https://github.com/Drako/SublimeBrainfuck/raw/master/Brainfuck.tmLanguage: +https://github.com/Drako/SublimeBrainfuck: - source.bf -https://github.com/JohnNilsson/awk-sublime/raw/master/AWK.tmLanguage: +https://github.com/JohnNilsson/awk-sublime: - source.awk https://github.com/JonBons/Sublime-SQF-Language: - source.sqf @@ -46,7 +46,7 @@ https://github.com/Red-Nova-Technologies/autoitv3-tmbundle: - source.autoit.3 https://github.com/SalGnt/Sublime-VimL: - source.viml -https://github.com/Shammah/boo-sublime/raw/master/Boo.tmLanguage: +https://github.com/Shammah/boo-sublime: - source.boo https://github.com/SublimeText/ColdFusion: - source.cfscript @@ -110,7 +110,7 @@ https://github.com/brandonwamboldt/sublime-nginx: - source.nginx https://github.com/bro/bro-sublime: - source.bro -https://github.com/carsonoid/sublime_man_page_support/raw/master/man-groff.tmLanguage: +https://github.com/carsonoid/sublime_man_page_support: - text.groff https://github.com/ccreutzig/sublime-MuPAD: - source.mupad @@ -127,7 +127,7 @@ https://github.com/clemos/haxe-sublime-bundle: https://github.com/cucumber/cucumber-tmbundle: - source.ruby.rspec.cucumber.steps - text.gherkin.feature -https://github.com/daaain/Handlebars/raw/master/Handlebars.tmLanguage: +https://github.com/daaain/Handlebars: - text.html.handlebars https://github.com/davidpeckham/powershell.tmbundle: - source.powershell @@ -140,7 +140,7 @@ https://github.com/elixir-lang/elixir-tmbundle: - text.html.elixir https://github.com/ericzou/ebundles/raw/master/Bundles/MSDOS%20batch%20file.tmbundle/Syntaxes/MSDOS%20batch%20file.tmLanguage: - source.dosbatch -https://github.com/euler0/sublime-glsl/raw/master/GLSL.tmLanguage: +https://github.com/euler0/sublime-glsl: - source.glsl https://github.com/fancy-lang/fancy-tmbundle: - source.fancy @@ -148,27 +148,27 @@ https://github.com/fsharp/fsharpbinding: - source.fsharp https://github.com/gingerbeardman/monkey.tmbundle: - source.monkey -https://github.com/guillermooo/dart-sublime-bundle/raw/master/Dart.tmLanguage: +https://github.com/guillermooo/dart-sublime-bundle: - source.dart -https://github.com/harrism/sublimetext-cuda-cpp/raw/master/cuda-c%2B%2B.tmLanguage: +https://github.com/harrism/sublimetext-cuda-cpp: - source.cuda-c++ https://github.com/hww3/pike-textmate: - source.pike -https://github.com/jeancharles-roger/ceylon-sublimetext/raw/master/Ceylon.tmLanguage: +https://github.com/jeancharles-roger/ceylon-sublimetext: - source.ceylon https://github.com/jfairbank/Sublime-Text-2-OpenEdge-ABL: - source.abl https://github.com/jhasse/sublime-rust: - source.rust -https://github.com/johanasplund/sublime-befunge/raw/master/Befunge-93.tmLanguage: +https://github.com/johanasplund/sublime-befunge: - source.befunge https://github.com/joshaven/RDoc.tmbundle: - text.rdoc -https://github.com/jpcamara/Textmate-Gosu-Bundle/raw/master/Gosu.tmbundle/Syntaxes/Gosu.tmLanguage: +https://github.com/jpcamara/Textmate-Gosu-Bundle: - source.gosu.2 https://github.com/kswedberg/jquery-tmbundle: - source.js.jquery -https://github.com/laughedelic/sublime-idris/raw/master/Idris.tmLanguage: +https://github.com/laughedelic/sublime-idris: - source.idris https://github.com/lavrton/sublime-better-typescript: - source.ts @@ -196,13 +196,13 @@ https://github.com/mgalloy/idl.tmbundle: - text.idl-idldoc https://github.com/michaeledgar/protobuf-tmbundle: - source.protobuf -https://github.com/mkolosick/Sublime-Coq/raw/master/Coq.tmLanguage: +https://github.com/mkolosick/Sublime-Coq: - source.coq https://github.com/mokus0/Agda.tmbundle: - source.agda https://github.com/nanoant/Julia.tmbundle: - source.julia -https://github.com/nanoant/assembly.tmbundle/raw/master/Syntaxes/objdump%20C%2B%2B.tmLanguage: +https://github.com/nanoant/assembly.tmbundle: - objdump.x86asm https://github.com/nilium/ooc.tmbundle: - source.ooc @@ -229,7 +229,7 @@ https://github.com/skozlovf/Sublime-QML: - source.qml https://github.com/slash-lang/Slash.tmbundle: - text.html.slash -https://github.com/slavapestov/factor/raw/master/misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage: +https://github.com/slavapestov/factor: - source.factor https://github.com/slim-template/ruby-slim.tmbundle: - text.slim @@ -410,7 +410,7 @@ https://github.com/textmate/xml.tmbundle: - text.xml.xsl https://github.com/tomas-stefano/smalltalk-tmbundle: - source.smalltalk -https://github.com/vic/ioke-outdated/raw/master/share/TextMate/Ioke.tmbundle/Syntaxes/Ioke.tmLanguage: +https://github.com/vic/ioke-outdated: - source.ioke https://github.com/vkostyukov/kotlin-sublime-package: - source.Kotlin @@ -420,15 +420,15 @@ https://github.com/whitequark/llvm.tmbundle: - source.llvm https://github.com/wmertens/sublime-nix: - source.nix -https://raw.githubusercontent.com/eregon/oz-tmbundle/master/Syntaxes/Oz.tmLanguage: +https://github.com/eregon/oz-tmbundle/raw/master/Syntaxes/Oz.tmLanguage: - source.oz -https://raw.githubusercontent.com/sebgod/mercury-tmlanguage/master/Mercury.tmLanguage: +https://github.com/sebgod/mercury-tmlanguage: - source.mercury -https://raw.githubusercontent.com/tenbits/sublime-mask/release/Syntaxes/mask.tmLanguage: +https://github.com/tenbits/sublime-mask/raw/release/Syntaxes/mask.tmLanguage: - source.mask https://github.com/l15n/fish-tmbundle: - source.fish -https://raw.githubusercontent.com/andik/IDL-Syntax/master/IDL.tmLanguage: +https://github.com/andik/IDL-Syntax: - source.webidl -https://raw.githubusercontent.com/atmarksharp/jasmin-sublime/master/Jasmin.tmLanguage: +https://github.com/atmarksharp/jasmin-sublime: - source.jasmin From 8fbb7a1d931884f7463a80913903408a01b7b747 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Wed, 17 Dec 2014 16:16:17 -0500 Subject: [PATCH 3/5] Sort grammars.yml --- grammars.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/grammars.yml b/grammars.yml index 49292343..5288597d 100644 --- a/grammars.yml +++ b/grammars.yml @@ -63,6 +63,8 @@ https://github.com/alkemist/gradle.tmbundle: - source.groovy.gradle https://github.com/ambethia/Sublime-Loom: - source.loomscript +https://github.com/andik/IDL-Syntax: +- source.webidl https://github.com/angryant0007/VBDotNetSyntax: - source.vbnet https://github.com/anunayk/cool-tmbundle: @@ -74,6 +76,8 @@ https://github.com/aroben/ruby.tmbundle@4636a3023153c3034eb6ffc613899ba9cf33b41f - text.html.erb https://github.com/asbjornenge/Docker.tmbundle: - source.dockerfile +https://github.com/atmarksharp/jasmin-sublime: +- source.jasmin https://github.com/atom/language-clojure: - source.clojure https://github.com/atom/language-coffee-script: @@ -138,6 +142,8 @@ https://github.com/elixir-lang/elixir-tmbundle: - source.elixir - text.elixir - text.html.elixir +https://github.com/eregon/oz-tmbundle/raw/master/Syntaxes/Oz.tmLanguage: +- source.oz https://github.com/ericzou/ebundles/raw/master/Bundles/MSDOS%20batch%20file.tmbundle/Syntaxes/MSDOS%20batch%20file.tmLanguage: - source.dosbatch https://github.com/euler0/sublime-glsl: @@ -168,6 +174,8 @@ https://github.com/jpcamara/Textmate-Gosu-Bundle: - source.gosu.2 https://github.com/kswedberg/jquery-tmbundle: - source.js.jquery +https://github.com/l15n/fish-tmbundle: +- source.fish https://github.com/laughedelic/sublime-idris: - source.idris https://github.com/lavrton/sublime-better-typescript: @@ -217,6 +225,8 @@ https://github.com/pvl/abap.tmbundle: https://github.com/scalate/Scalate.tmbundle: - source.scaml - text.html.ssp +https://github.com/sebgod/mercury-tmlanguage: +- source.mercury https://github.com/shadanan/mathematica-tmbundle: - source.mathematica https://github.com/shellderp/sublime-robot-plugin: @@ -240,6 +250,8 @@ https://github.com/statatmbundle/Stata.tmbundle: - source.stata https://github.com/technosophos/Vala-TMBundle: - source.vala +https://github.com/tenbits/sublime-mask/raw/release/Syntaxes/mask.tmLanguage: +- source.mask https://github.com/textmate/ant.tmbundle: - text.xml.ant https://github.com/textmate/antlr.tmbundle: @@ -254,10 +266,6 @@ https://github.com/textmate/asp.tmbundle: - text.html.asp https://github.com/textmate/bison.tmbundle: - source.bison -https://github.com/vmg/c.tmbundle: -- source.c -- source.c++ -- source.c.platform https://github.com/textmate/capnproto.tmbundle: - source.capnp https://github.com/textmate/cmake.tmbundle: @@ -414,21 +422,13 @@ https://github.com/vic/ioke-outdated: - source.ioke https://github.com/vkostyukov/kotlin-sublime-package: - source.Kotlin +https://github.com/vmg/c.tmbundle: +- source.c +- source.c++ +- source.c.platform https://github.com/vmg/zephir-sublime: - source.php.zephir https://github.com/whitequark/llvm.tmbundle: - source.llvm https://github.com/wmertens/sublime-nix: - source.nix -https://github.com/eregon/oz-tmbundle/raw/master/Syntaxes/Oz.tmLanguage: -- source.oz -https://github.com/sebgod/mercury-tmlanguage: -- source.mercury -https://github.com/tenbits/sublime-mask/raw/release/Syntaxes/mask.tmLanguage: -- source.mask -https://github.com/l15n/fish-tmbundle: -- source.fish -https://github.com/andik/IDL-Syntax: -- source.webidl -https://github.com/atmarksharp/jasmin-sublime: -- source.jasmin From f428c561c90b2e3d0b20f11ec442192c97bebf35 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Wed, 17 Dec 2014 16:23:57 -0500 Subject: [PATCH 4/5] Remove the WebIDL grammar This grammar uses the same scope name (source.idl) as our existing IDL grammar. The wrong scope name was listed in grammars.yml which masked this problem. https://github.com/andik/IDL-Syntax/pull/2 tracks getting the grammar to use a different scope name; in the meantime we just won't highlight these files. --- grammars.yml | 2 -- lib/linguist/languages.yml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/grammars.yml b/grammars.yml index 5288597d..9cd40188 100644 --- a/grammars.yml +++ b/grammars.yml @@ -63,8 +63,6 @@ https://github.com/alkemist/gradle.tmbundle: - source.groovy.gradle https://github.com/ambethia/Sublime-Loom: - source.loomscript -https://github.com/andik/IDL-Syntax: -- source.webidl https://github.com/angryant0007/VBDotNetSyntax: - source.vbnet https://github.com/anunayk/cool-tmbundle: diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index bddc4568..8db980d8 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -3057,7 +3057,7 @@ WebIDL: type: programming extensions: - .webidl - tm_scope: source.webidl + tm_scope: none ace_mode: text XC: From 60d40c8ad8a60d8c089de4bcd9ee3048997c528f Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Wed, 17 Dec 2014 16:30:33 -0500 Subject: [PATCH 5/5] Update grammars.yml I just ran script/download-grammars and these are the changes it made. The most notable one is that we had the wrong scope listed for Markdown. --- grammars.yml | 9 ++++++++- lib/linguist/languages.yml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/grammars.yml b/grammars.yml index 9cd40188..75203406 100644 --- a/grammars.yml +++ b/grammars.yml @@ -86,7 +86,7 @@ https://github.com/atom/language-csharp: - source.csx - source.nant-build https://github.com/atom/language-gfm: -- text.html.markdown +- source.gfm https://github.com/atom/language-javascript: - source.js - source.js.regexp @@ -113,6 +113,7 @@ https://github.com/brandonwamboldt/sublime-nginx: https://github.com/bro/bro-sublime: - source.bro https://github.com/carsonoid/sublime_man_page_support: +- source.man - text.groff https://github.com/ccreutzig/sublime-MuPAD: - source.mupad @@ -145,6 +146,7 @@ https://github.com/eregon/oz-tmbundle/raw/master/Syntaxes/Oz.tmLanguage: https://github.com/ericzou/ebundles/raw/master/Bundles/MSDOS%20batch%20file.tmbundle/Syntaxes/MSDOS%20batch%20file.tmLanguage: - source.dosbatch https://github.com/euler0/sublime-glsl: +- source.essl - source.glsl https://github.com/fancy-lang/fancy-tmbundle: - source.fancy @@ -154,11 +156,14 @@ https://github.com/gingerbeardman/monkey.tmbundle: - source.monkey https://github.com/guillermooo/dart-sublime-bundle: - source.dart +- source.pubspec +- text.dart-doccomments https://github.com/harrism/sublimetext-cuda-cpp: - source.cuda-c++ https://github.com/hww3/pike-textmate: - source.pike https://github.com/jeancharles-roger/ceylon-sublimetext: +- module.ceylon - source.ceylon https://github.com/jfairbank/Sublime-Text-2-OpenEdge-ABL: - source.abl @@ -210,6 +215,7 @@ https://github.com/nanoant/Julia.tmbundle: - source.julia https://github.com/nanoant/assembly.tmbundle: - objdump.x86asm +- source.x86asm https://github.com/nilium/ooc.tmbundle: - source.ooc https://github.com/paulmillr/LiveScript.tmbundle: @@ -239,6 +245,7 @@ https://github.com/slash-lang/Slash.tmbundle: - text.html.slash https://github.com/slavapestov/factor: - source.factor +- text.html.factor https://github.com/slim-template/ruby-slim.tmbundle: - text.slim https://github.com/staltz/SublimeXtend: diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 8db980d8..d69b072a 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1725,7 +1725,7 @@ Markdown: - .mkdn - .mkdown - .ron - tm_scope: text.html.markdown + tm_scope: source.gfm Mask: type: markup