Skip to content

Instantly share code, notes, and snippets.

@nicolas-oliveira
Last active September 8, 2020 14:45
Show Gist options
  • Save nicolas-oliveira/76de8e56fa2e7cc1d234d2a951cc1425 to your computer and use it in GitHub Desktop.
Save nicolas-oliveira/76de8e56fa2e7cc1d234d2a951cc1425 to your computer and use it in GitHub Desktop.
All compile / run commands configuration for common languages in Run on save extension. Contains: Javascript C++ C# and C.
"runOnSave.commands": [
{
"match": "\\.js$",
"runIn": "terminal",
"command": "clear && node ${fileBasename}"
},
{
"match": "\\.cpp$",
"runIn": "terminal",
"command": "clear && g++ -g -o file.o ${fileBasename} && ./file.o && rm ./file.o"
},
{
"match": "\\.c$",
"runIn": "terminal",
"command": "clear && gcc -lm -g -o file.o ${fileBasename} && ./file.o && rm ./file.o"
},
{
"match": "\\.cs$",
"runIn": "terminal",
"command": "clear && mcs -o out.exe ${fileBasename} && clear && mono out.exe && rm out.exe"
},
{
// Para funcionar deve-se colocar o mesmo nome para a pasta do programa e para a classe principal Main e o package
// Abra o vscode no diretório acima da pasta do programa, e execute pelo terminal dentro da pasta do programa
// / -> Abra o vscode aqui
// └── Projeto -> Coloque o terminal integrado aqui e execute o comando
// ├── Projeto.java
// └── File1.java
"match": "\\.java$",
"runIn": "terminal",
"command": "clear && javac *.java && clear && java -classpath ${workspaceFolder} ${fileBasenameNoExtension}.${fileBasenameNoExtension} && rm *.class"
}
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment