Giter VIP home page Giter VIP logo

vs-code-config's Introduction

Make Coding Easy

This tutorial is for linux (debian based) only
If you are a windows user then check this out Setup VS Code for windows

1. VS code task config to make competitive programming easy and programme analysis !

This is a .json file which will help you to run your cpp file with one click or shortcut.

In this case , you don't need to write input in the command line or write fopen / close stuffs , programme will take input from a file (input.txt) automatically and give the output in another file (output.txt). Input Output

You can also find the programme runtime status which will help you to calculate execution time as well as memory usage and many more ! Time Status

pre-requirements :

  • Visual Studio Code
  • gcc/g++
  • time
    • install time : sudo apt install time

Let's setup

Note : You just need to do these things only for the first time of your workspace!

  • Split screen in 3 sections

    • split the main section in right (right mouse click on the .cpp file and u will get the split options)
    • then split the right into down (same as above)

Split SS

  • create a file named input.txt and save it in the same folder
  • create a file named output.txt and save it in the same folder
  • open input.txt into the upper right section
  • open output.txt into the lower right section

This will be the final look of your vs code

VS Code Final Look

How to setup

  • Go to Configure Default Build Task...

    • In Menu bar

      • Click on Terminal (At the left top bar ) Top Bar
      • select configure task
      • select create task.json from template (this will create a task.json file in .vscode in your working directory)
      • select other and new task.json file will be created
      • now copy and paste the task.json { link is here } file into your task.json file
      • done

Usage

  • Run :
    • Shortcut type : ctrl+shift+b
  • You need to give the input in the input.txt file
  • output will be shown in the output.txt file

Note : Make sure your mouse cursor is clicked or focused on the cpp file editor while you are running your code.

Input Output

  • Bonus : programme status will be shown in the sys.txt file
  • People concern about more details such as binary form and disassemble code can check tasks(extra).json file Link

In the Repository i have also added config files for other Programming Languages too

Note : Here, I have merged all the files which includes tasks.json file for Python, C, C++, Java and Dart for both Windows and Linux! Here is the Link

2. VS CODE Snippet

This one is made for my personal usage, you can add functions as you wish and edit my name and doc.

  • Select User Snippets under File (at Left top bar) > Preferences (Code > Preferences on macOS), and then select cpp.json Top Bar
  • copy or replace the cpp.json file {Link} and save !

Usage

  • Creating a cpp file if you type inc and press Tab in your keyboard the snippet will load as i have set prefix as inc in my json file . (You can edit as your own !)
  • This will make programming easy and fast .

In the Repository i have also added config files for other Programming Languages too

Happy Coding with VS Code

vs-code-config's People

Contributors

jota12x avatar jspw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vs-code-config's Issues

iam getting this error sir

  • Executing task: copy "C:\Users\shaik\OneDrive\Documents\New folder\hello.cpp" 'C:\Users\shaik\OneDrive\Documents\New folder\jspwTest.cpp' && g++ jspwTest.cpp -o jspwTest && jspwTest < input.txt > output.txt && del jspwTest.exe && del jspwTest.cpp

bash: copy: command not found

  • The terminal process "C:\Program Files\Git\bin\bash.exe '--login', '-i', '-c', ' copy "C:\Users\shaik\OneDrive\Documents\New folder\hello.cpp" 'C:\Users\shaik\OneDrive\Documents\New folder\jspwTest.cpp' && g++ jspwTest.cpp -o jspwTest && jspwTest < input.txt > output.txt && del jspwTest.exe && del jspwTest.cpp'" terminated with exit code: 127.
  • Terminal will be reused by tasks, press any key to close it.

Vs code Config not working

Whatever setting you've mentioned over here I have done all exactly but it's not working
when I press ctrl + shift + B then in downward something like building is happening for 5 seconds then it also stops
Please tell me how I can resolve this issue...

v2.mp4

Ctrl + Shift + B produces unexpected errors.

*The terminal process "C:\Program Files\Git\bin\bash.exe '-c', ' cp C:\Users\SD\Desktop\CP\Programs\test.cpp C:\Users\SD\Desktop\CP && g++ test.cpp -o test.out && ./test.out < input.txt > output.txt && rm out && rm test.cpp'" failed to launch (exit code: 1).

Terminal will be reused by tasks, press any key to close it.

P.S. I use Windows OS(64-bit)

1

No such File or Directory error

> Executing task:  g++ -g PalindromicArray\PalindromicArray.cpp -o PalindromicArray.out && clear && timeout 10 /usr/bin/time -v --output sys.txt ./PalindromicArray.out < input.txt > output.txt && rm *out <

g++.exe: error: PalindromicArrayPalindromicArray.cpp: No such file or directory
g++.exe: fatal error: no input files
compilation terminated.
The terminal process "C:\Program Files\Git\bin\bash.exe '-c', ' g++ -g PalindromicArray\PalindromicArray.cpp -o PalindromicArray.out && clear && timeout 10 /usr/bin/time -v --output sys.txt ./PalindromicArray.out < input.txt > output.txt && rm *out'" failed to launch (exit code: 1).

Terminal will be reused by tasks, press any key to close it.

Here's my folder structure
image

Task not working with file name LearnC++.cpp

Hello
I recently discovered that when i am trying to run task in learn.cpp it is working fine but when I run same task in learnC++.cpp it showing me an error
Does anyone has any idea how I can solve this problem ?
i am using the latest tasks.json file and cmd as default shell
WhatsApp Image 2023-05-10 at 7 03 23 PM

Problem regarding Task.json file Windows

I had recently updated my laptop and PowerShell would also have had been updated with that. Currently there were two errors

  1. "&&" was not being recognised but it was corrected using "-and", I don't know if it will work or not but yes.
  2. I have attached the image of the associated error where it is showing "The '<' operator is reserved for future use."
    image

output.txt window does not show output , tasks.json shows errors

hey
after adding code in the tasks.jason file and performing all the steps as it is the termial shiw the following errors
and even when the errors are solved the output.txt file does not show the output with the input.txt file input

Executing task: copy "C:\Users\Ayushi Shrivastava\c++ strivers.vscode\demo.cpp" 'C:\Users\Ayushi Shrivastava\c++ strivers\jspwTest.cpp' && g++ jspwTest.cpp -o jspwTest && jspwTest < input.txt > output.txt && del jspwTest.exe && del jspwTest.cpp

The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command copy "C:\Users\Ayushi Shrivastava\c++ strivers.vscode\demo.cpp" 'C:\Users\Ayushi Shrivastava\c++ strivers\jspwTest.cpp' && g++ jspwTest.cpp -o jspwTest && jspwTest < input.txt > output.txt && del jspwTest.exe && del jspwTest.cpp" terminated with exit code: 1.

  • Terminal will be reused by tasks, press any key to close it.

  • Executing task: copy "C:\Users\Ayushi Shrivastava\c++ strivers.vscode\demo.cpp" 'C:\Users\Ayushi Shrivastava\c++ strivers\jspwTest.cpp' && g++ jspwTest.cpp -o jspwTest && jspwTest < input.txt > output.txt && del jspwTest.exe && del jspwTest.cpp

The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command copy "C:\Users\Ayushi Shrivastava\c++ strivers.vscode\demo.cpp" 'C:\Users\Ayushi Shrivastava\c++ strivers\jspwTest.cpp' && g++ jspwTest.cpp -o jspwTest && jspwTest < input.txt > output.txt && del jspwTest.exe && del jspwTest.cpp" terminated with exit code: 1.

  • Terminal will be reused by tasks, press any key to close it.

  • Executing task: copy "C:\Users\Ayushi Shrivastava\c++ strivers.vscode\input.txt" 'C:\Users\Ayushi Shrivastava\c++ strivers\jspwTest.cpp' && g++ jspwTest.cpp -o jspwTest && jspwTest < input.txt > output.txt && del jspwTest.exe && del jspwTest.cpp
    The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command copy "C:\Users\Ayushi Shrivastava\c++ strivers.vscode\input.txt" 'C:\Users\Ayushi Shrivastava\c++ strivers\jspwTest.cpp' && g++ jspwTest.cpp -o jspwTest && jspwTest < input.txt > output.txt && del jspwTest.exe && del jspwTest.cpp" terminated with exit code: 1.

  • Terminal will be reused by tasks, press any key to close it.

  • Executing task: copy "C:\Users\Ayushi Shrivastava\c++ strivers.vscode\demo.cpp" 'C:\Users\Ayushi Shrivastava\c++ strivers\jspwTest.cpp' && g++ jspwTest.cpp -o jspwTest && jspwTest < input.txt > output.txt && del jspwTest.exe && del jspwTest.cpp

VSCode Default Terminal (Windows) as PowerShell

I was following the tutorial for getting everything working on Windows. I was wondering if it would be possible to make it, so that we can use PowerShell instead of having to set the default terminal as CMD?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.