Skip to content

Commit 8a0d898

Browse files
authored
Added the support for .cc and .cxx file extensions and fixed a minor issue in the dev-guide (#546)
* feat: Added support for .cc and .cxx file extensions * docs: Changed Jest unit test command from `npm run jest` to `npm run test`
1 parent 7b7e834 commit 8a0d898

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

docs/dev-guide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ We recommend installing `Prettier` and `ESLint` VS Code extensions. Before
6666
commiting, make sure you are passing the following tests:
6767

6868
- ESLint lint: `npm run lint`.
69-
- Jest unit tests: `npm run jest`.
69+
- Jest unit tests: `npm run test`.
7070
- Typescript compilation: `npm run test-compile`.
7171
- Pre-publish bundling: `npm run vscode:prepublish`.
7272

src/compiler.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ const getFlags = (language: Language, srcPath: string): string[] => {
6969
if (args[0] === '') args = [];
7070
let ret: string[];
7171
switch (language.name) {
72-
case 'cpp': {
72+
case 'cpp':
73+
case 'cc':
74+
case 'cxx': {
7375
ret = [
7476
srcPath,
7577
getCppOutputArgPref(),

src/config.ts

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export default {
1313
extensions: {
1414
c: 'c',
1515
cpp: 'cpp',
16+
cc: 'cpp',
17+
cxx: 'cpp',
1618
csharp: 'cs',
1719
python: 'py',
1820
ruby: 'rb',
@@ -64,6 +66,8 @@ export default {
6466
supportedExtensions: [
6567
'py',
6668
'cpp',
69+
'cc',
70+
'cxx',
6771
'rs',
6872
'c',
6973
'java',

src/preferences.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ export const getLanguageId = (srcPath: string): number => {
142142
const extension = path.extname(srcPath);
143143
let compiler = null;
144144
switch (extension) {
145-
case '.cpp': {
145+
case '.cpp':
146+
case '.cc':
147+
case '.cxx': {
146148
compiler = getPreference('language.cpp.SubmissionCompiler');
147149
break;
148150
}

src/types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ export type LangNames =
6262
| 'ruby'
6363
| 'c'
6464
| 'cpp'
65+
| 'cc'
66+
| 'cxx'
6567
| 'rust'
6668
| 'java'
6769
| 'js'

src/utils.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export const getLanguage = (srcPath: string): Language => {
5050
}
5151

5252
switch (langName) {
53-
case 'cpp': {
53+
case 'cpp':
54+
case 'cc':
55+
case 'cxx': {
5456
return {
5557
name: langName,
5658
args: [...getCppArgsPref()],

0 commit comments

Comments
 (0)