diff --git a/grammars.yml b/grammars.yml index 1bedce80..ae0245e4 100644 --- a/grammars.yml +++ b/grammars.yml @@ -420,3 +420,5 @@ https://github.com/wmertens/sublime-nix: - source.nix https://raw.githubusercontent.com/eregon/oz-tmbundle/master/Syntaxes/Oz.tmLanguage: - source.oz +https://raw.githubusercontent.com/tenbits/sublime-mask/release/Syntaxes/mask.tmLanguage: +- source.mask \ No newline at end of file diff --git a/lib/linguist/heuristics.rb b/lib/linguist/heuristics.rb index de3097eb..5766b1fe 100644 --- a/lib/linguist/heuristics.rb +++ b/lib/linguist/heuristics.rb @@ -61,6 +61,14 @@ module Linguist @heuristic.call(data) end + disambiguate "BitBake", "BlitzBasic" do |data| + if /^\s*; /.match(data) || data.include?("End Function") + Language["BlitzBasic"] + elsif /^\s*(# |include|require)\b/.match(data) + Language["BitBake"] + end + end + disambiguate "Objective-C", "C++", "C" do |data| if (/@(interface|class|protocol|property|end|synchronised|selector|implementation)\b/.match(data)) Language["Objective-C"] @@ -156,6 +164,14 @@ module Linguist end end + disambiguate "TypeScript", "XML" do |data| + if data.include?(" + + + + MainWindow + + + United Kingdom + Reino Unido + + + + God save the Queen + Deus salve a Rainha + + + + England + Inglaterra + + + + Wales + Gales + + + + Scotland + Escócia + + + + Northern Ireland + Irlanda Norte + + + + Portuguese + Português + + + + English + Inglês + + + diff --git a/test/test_heuristics.rb b/test/test_heuristics.rb index 7f487ecf..c874299a 100644 --- a/test/test_heuristics.rb +++ b/test/test_heuristics.rb @@ -150,4 +150,11 @@ class TestHeuristcs < Test::Unit::TestCase "LoomScript" => "LoomScript/HelloWorld.ls" }) end + + def test_ts_by_heuristics + assert_heuristics({ + "TypeScript" => all_fixtures("TypeScript", "*.ts"), + "XML" => all_fixtures("XML", "*.ts") + }) + end end