[Web] Add vscode launch json to cpp template
This commit is contained in:
parent
ba5fa18000
commit
1e849c8686
@ -10,6 +10,8 @@ import {
|
|||||||
templateCppCMakeLists,
|
templateCppCMakeLists,
|
||||||
templateCppGitIgnore,
|
templateCppGitIgnore,
|
||||||
templateCppProblem,
|
templateCppProblem,
|
||||||
|
templateCppVscodeLaunch,
|
||||||
|
templateCppVscodeTasks,
|
||||||
templateJavaProblem
|
templateJavaProblem
|
||||||
} from './templates';
|
} from './templates';
|
||||||
|
|
||||||
@ -52,6 +54,10 @@ async function addProblemsCPP(opts: OptsAddProblems) {
|
|||||||
});
|
});
|
||||||
opts.fs.writeFileSync(join(opts.dir, 'CMakeLists.txt'), cmakeLists);
|
opts.fs.writeFileSync(join(opts.dir, 'CMakeLists.txt'), cmakeLists);
|
||||||
|
|
||||||
|
opts.fs.mkdirSync(join(opts.dir, '.vscode'));
|
||||||
|
opts.fs.writeFileSync(join(opts.dir, '.vscode', 'launch.json'), templateCppVscodeLaunch);
|
||||||
|
opts.fs.writeFileSync(join(opts.dir, '.vscode', 'tasks.json'), templateCppVscodeTasks);
|
||||||
|
|
||||||
opts.contest.problems.forEach((problem) => {
|
opts.contest.problems.forEach((problem) => {
|
||||||
opts.fs.mkdirSync(join(opts.dir, problem.pascalName));
|
opts.fs.mkdirSync(join(opts.dir, problem.pascalName));
|
||||||
const filledTemplate = templateCppProblem.replaceAll('%%pascalName%%', problem.pascalName);
|
const filledTemplate = templateCppProblem.replaceAll('%%pascalName%%', problem.pascalName);
|
||||||
|
@ -41,5 +41,67 @@ int main()
|
|||||||
return 0;
|
return 0;
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
export const templateCppGitIgnore = `/build
|
export const templateCppGitIgnore = `/**/build
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const templateCppVscodeLaunch = `{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "C/C++: g++ build and debug active file",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "\${fileDirname}/build/\${fileBasenameNoExtension}.out",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"cwd": "\${fileDirname}",
|
||||||
|
"environment": [],
|
||||||
|
"externalConsole": false,
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Set Disassembly Flavor to Intel",
|
||||||
|
"text": "-gdb-set disassembly-flavor intel",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"preLaunchTask": "C/C++: g++ build active file",
|
||||||
|
"miDebuggerPath": "/usr/bin/gdb"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": "2.0.0"
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
export const templateCppVscodeTasks = `{
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "cppbuild",
|
||||||
|
"label": "C/C++: g++ build active file",
|
||||||
|
"command": "/usr/bin/g++",
|
||||||
|
"args": [
|
||||||
|
"-fdiagnostics-color=always",
|
||||||
|
"-g",
|
||||||
|
"\${file}",
|
||||||
|
"-o",
|
||||||
|
"\${fileDirname}/build/\${fileBasenameNoExtension}.out"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"cwd": "\${fileDirname}"
|
||||||
|
},
|
||||||
|
"problemMatcher": [
|
||||||
|
"$gcc"
|
||||||
|
],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"detail": "Task generated by Debugger."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": "2.0.0"
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
Loading…
Reference in New Issue
Block a user