Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ts support (for vscode-leetcode) #45

Merged
merged 3 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const DEFAULT_CONFIG = {
'ruby',
'rust',
'scala',
'swift'
'swift',
'typescript'
],
urls: {
// base urls
Expand Down
3 changes: 2 additions & 1 deletion lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const LANGS = [
{lang: 'ruby', ext: '.rb', style: '#'},
{lang: 'rust', ext: '.rs', style: 'c'},
{lang: 'scala', ext: '.scala', style: 'c'},
{lang: 'swift', ext: '.swift', style: 'c'}
{lang: 'swift', ext: '.swift', style: 'c'},
{lang: 'typescript', ext: '.ts', style: 'c'}
];

const h = {};
Expand Down
3 changes: 3 additions & 0 deletions test/test_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ describe('helper', function() {
assert.equal(h.langToExt('scala'), '.scala');
assert.equal(h.langToExt('swift'), '.swift');
assert.equal(h.langToExt('rust'), '.rs');
assert.equal(h.langToExt('typescript'), '.ts');
});
}); // #langToExt

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

Expand All @@ -182,6 +184,7 @@ describe('helper', function() {
assert.deepEqual(h.langToCommentStyle('ruby'), RUBY_STYLE);
assert.deepEqual(h.langToCommentStyle('scala'), C_STYLE);
assert.deepEqual(h.langToCommentStyle('swift'), C_STYLE);
assert.deepEqual(h.langToCommentStyle('typescript'), C_STYLE);
});
}); // #langToCommentStyle

Expand Down