Skip to content

Commit 404420e

Browse files
authoredJun 18, 2020
Add ts support (for vscode-leetcode) (#45)
1 parent 5a23270 commit 404420e

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed
 

‎lib/config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ const DEFAULT_CONFIG = {
2929
'ruby',
3030
'rust',
3131
'scala',
32-
'swift'
32+
'swift',
33+
'typescript'
3334
],
3435
urls: {
3536
// base urls

‎lib/helper.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ const LANGS = [
4545
{lang: 'ruby', ext: '.rb', style: '#'},
4646
{lang: 'rust', ext: '.rs', style: 'c'},
4747
{lang: 'scala', ext: '.scala', style: 'c'},
48-
{lang: 'swift', ext: '.swift', style: 'c'}
48+
{lang: 'swift', ext: '.swift', style: 'c'},
49+
{lang: 'typescript', ext: '.ts', style: 'c'}
4950
];
5051

5152
const h = {};

‎test/test_helper.js

+3
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ describe('helper', function() {
136136
assert.equal(h.langToExt('scala'), '.scala');
137137
assert.equal(h.langToExt('swift'), '.swift');
138138
assert.equal(h.langToExt('rust'), '.rs');
139+
assert.equal(h.langToExt('typescript'), '.ts');
139140
});
140141
}); // #langToExt
141142

@@ -158,6 +159,7 @@ describe('helper', function() {
158159
assert.equal(h.extToLang('~/leetcode/../file.sql'), 'mysql');
159160
assert.equal(h.extToLang('/home/skygragon/file.dat'), 'unknown');
160161
assert.equal(h.extToLang('~/leetcode/file.rs'), 'rust');
162+
assert.equal(h.extToLang('~/leetcode/file.ts'), 'typescript');
161163
});
162164
}); // #extToLang
163165

@@ -182,6 +184,7 @@ describe('helper', function() {
182184
assert.deepEqual(h.langToCommentStyle('ruby'), RUBY_STYLE);
183185
assert.deepEqual(h.langToCommentStyle('scala'), C_STYLE);
184186
assert.deepEqual(h.langToCommentStyle('swift'), C_STYLE);
187+
assert.deepEqual(h.langToCommentStyle('typescript'), C_STYLE);
185188
});
186189
}); // #langToCommentStyle
187190

0 commit comments

Comments
 (0)
Please sign in to comment.