mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	TypeScript language support
Signed-off-by: PulsarBlow <pulsarblow@gmail.com>
This commit is contained in:
		| @@ -1228,6 +1228,14 @@ Twig: | |||||||
|   lexer: HTML+Django/Jinja |   lexer: HTML+Django/Jinja | ||||||
|   primary_extension: .twig |   primary_extension: .twig | ||||||
|  |  | ||||||
|  | TypeScript: | ||||||
|  |   type: programming | ||||||
|  |   color: "#31859c" | ||||||
|  |   lexer: Text only | ||||||
|  |   aliases: | ||||||
|  |   - ts | ||||||
|  |   primary_extension: .ts | ||||||
|  |  | ||||||
| VHDL: | VHDL: | ||||||
|   type: programming |   type: programming | ||||||
|   lexer: vhdl |   lexer: vhdl | ||||||
|   | |||||||
							
								
								
									
										28
									
								
								samples/TypeScript/classes.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								samples/TypeScript/classes.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | |||||||
|  | class Animal { | ||||||
|  |     constructor(public name) { } | ||||||
|  |     move(meters) { | ||||||
|  |         alert(this.name + " moved " + meters + "m."); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | class Snake extends Animal { | ||||||
|  |     constructor(name) { super(name); } | ||||||
|  |     move() { | ||||||
|  |         alert("Slithering..."); | ||||||
|  |         super.move(5); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | class Horse extends Animal { | ||||||
|  |     constructor(name) { super(name); } | ||||||
|  |     move() { | ||||||
|  |         alert("Galloping..."); | ||||||
|  |         super.move(45); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | var sam = new Snake("Sammy the Python") | ||||||
|  | var tom: Animal = new Horse("Tommy the Palomino") | ||||||
|  |  | ||||||
|  | sam.move() | ||||||
|  | tom.move(34) | ||||||
							
								
								
									
										0
									
								
								samples/TypeScript/empty.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								samples/TypeScript/empty.ts
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										1
									
								
								samples/TypeScript/hello.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								samples/TypeScript/hello.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | console.log "Hello, World!" | ||||||
| @@ -175,6 +175,9 @@ class TestBlob < Test::Unit::TestCase | |||||||
|     # CoffeeScript-generated JS |     # CoffeeScript-generated JS | ||||||
|     # TODO |     # TODO | ||||||
|  |  | ||||||
|  |     # TypeScript-generated JS | ||||||
|  |     # TODO | ||||||
|  |  | ||||||
|     # PEG.js-generated parsers |     # PEG.js-generated parsers | ||||||
|     assert blob("JavaScript/parser.js").generated? |     assert blob("JavaScript/parser.js").generated? | ||||||
|  |  | ||||||
|   | |||||||
| @@ -109,6 +109,7 @@ class TestLanguage < Test::Unit::TestCase | |||||||
|     assert_equal Language['Shell'], Language.find_by_alias('shell') |     assert_equal Language['Shell'], Language.find_by_alias('shell') | ||||||
|     assert_equal Language['Shell'], Language.find_by_alias('zsh') |     assert_equal Language['Shell'], Language.find_by_alias('zsh') | ||||||
|     assert_equal Language['TeX'], Language.find_by_alias('tex') |     assert_equal Language['TeX'], Language.find_by_alias('tex') | ||||||
|  |     assert_equal Language['TypeScript'], Language.find_by_alias('ts') | ||||||
|     assert_equal Language['VimL'], Language.find_by_alias('vim') |     assert_equal Language['VimL'], Language.find_by_alias('vim') | ||||||
|     assert_equal Language['VimL'], Language.find_by_alias('viml') |     assert_equal Language['VimL'], Language.find_by_alias('viml') | ||||||
|     assert_equal Language['reStructuredText'], Language.find_by_alias('rst') |     assert_equal Language['reStructuredText'], Language.find_by_alias('rst') | ||||||
| @@ -186,6 +187,7 @@ class TestLanguage < Test::Unit::TestCase | |||||||
|     assert_equal :programming, Language['PowerShell'].type |     assert_equal :programming, Language['PowerShell'].type | ||||||
|     assert_equal :programming, Language['Python'].type |     assert_equal :programming, Language['Python'].type | ||||||
|     assert_equal :programming, Language['Ruby'].type |     assert_equal :programming, Language['Ruby'].type | ||||||
|  |     assert_equal :programming, Language['TypeScript'].type | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def test_markup |   def test_markup | ||||||
| @@ -279,6 +281,7 @@ class TestLanguage < Test::Unit::TestCase | |||||||
|     assert_equal '#701516', Language['Ruby'].color |     assert_equal '#701516', Language['Ruby'].color | ||||||
|     assert_equal '#3581ba', Language['Python'].color |     assert_equal '#3581ba', Language['Python'].color | ||||||
|     assert_equal '#f15501', Language['JavaScript'].color |     assert_equal '#f15501', Language['JavaScript'].color | ||||||
|  |     assert_equal '#31859c', Language['TypeScript'].color | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def test_colors |   def test_colors | ||||||
| @@ -317,6 +320,7 @@ class TestLanguage < Test::Unit::TestCase | |||||||
|     assert_equal '.js', Language['JavaScript'].primary_extension |     assert_equal '.js', Language['JavaScript'].primary_extension | ||||||
|     assert_equal '.coffee', Language['CoffeeScript'].primary_extension |     assert_equal '.coffee', Language['CoffeeScript'].primary_extension | ||||||
|     assert_equal '.t', Language['Turing'].primary_extension |     assert_equal '.t', Language['Turing'].primary_extension | ||||||
|  |     assert_equal '.ts', Language['TypeScript'].primary_extension | ||||||
|  |  | ||||||
|     # This is a nasty requirement, but theres some code in GitHub that |     # This is a nasty requirement, but theres some code in GitHub that | ||||||
|     # expects this. Really want to drop this. |     # expects this. Really want to drop this. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user