mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Disambiguate TypeScript with tsx extension. (#3464)
Using the technique as discussed in #2761.
This commit is contained in:
committed by
Colin Seymour
parent
b66fcb2529
commit
f1be771611
@@ -465,5 +465,13 @@ module Linguist
|
||||
Language["Scilab"]
|
||||
end
|
||||
end
|
||||
|
||||
disambiguate ".tsx" do |data|
|
||||
if /^\s*(import.+(from\s+|require\()['"]react|\/\/\/\s*<reference\s)/.match(data)
|
||||
Language["TypeScript"]
|
||||
elsif /^\s*<\?xml\s+version/i.match(data)
|
||||
Language["XML"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user