Skip to content

DynoW/pclp-vscode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

minimal PCLP VS Code configuration

I've created this repo for easy setup of a PCLP environment in Visual Studio Code

If you need help ask me or ChatGPT (same thing anyway :))

It includes things like:

  • autosave (so you don't cry if you close your computer)
  • formatter (so the checker doesn't cry that you didn't put the {} right)
  • debugger configuration - btw you must learn how to use the debugger, because you can examine your variables while the code is running and determine what's wrong with your code, spening less time bug hunting (search on youtube or annoy @alin1popa for more debugging demos)

Recommendation

Check out the config files above ^^^ and ask or search things you don't understand. ChatGPT is your friend. Tweak them so you can feel confident in your evironment. Break things, explore, almost everything is reversible.

How to clone this repository to your computer:

You can also just copy and paste the code from your browser into the corresponding files instead of using git clone, if you prefer

If you haven't already, install git:

dyno@ragnarok:~$ sudo apt update
dyno@ragnarok:~$ sudo apt install git -y
dyno@ragnarok:~$ git clone https://github.com/DynoW/pclp-vscode.git && cd ./pclp-vscode

How to check for updates:

dyno@ragnarok:~/pclp-vscode$ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

If you see different output, you probably have to do a $ git pull

Structure:

pclp-vscode
├── README.md <- you are reading this now
├── .clang-format <- the coding style that the PCLP checker uses (Linux Kernel)
├── .editorconfig <- extra config for vscode
└── .vscode
    ├── launch.json <- launch options for the debugger
    ├── settings.json <- workspace settings of vscode
    └── tasks.json <- autogenerated compile tasks for C compiler

2 directories, 6 files

Feel free to change the config files and extensions as you like

How to use these files:

Move them to your pclp directory where you have preferably a labs and a homework directory

(you can skip the README.md)

pclp
├── README.md
├── .clang-format
├── .editorconfig
├── labs
│   ├── lab1
│   │   ├── main <-- the executable of my program
│   │   └── main.c <-- the source code of my program
│   ├── lab2
│   ├── lab3
│   ├── lab4
│   └── lab5
├── teme
│   ├── tema0
│   │   ├── check <-- the checker
│   │   ├── check_chocolate_rain-2025.10.20.zip <-- the homework archive
│   │   ├── check_utils
│   │   ├── cs
│   │   ├── fizzbuzz <-- the executable of my program
│   │   ├── fizzbuzz.c <-- the source code of my program
│   │   ├── install <-- install script for the checker
│   │   ├── Makefile <-- copy of Makefile.example3
│   │   ├── Makefile.example1
│   │   ├── Makefile.example2
│   │   ├── Makefile.example3
│   │   ├── PCLP 2025 - Tema 0 - 2025.10.20.pdf <-- tasks pdf
│   │   ├── README <-- the explanation of my program
│   │   ├── README-checker.md
│   │   └── tasks <-- the directory in which verification tests are located
│   └── tema1
└── .vscode
    ├── launch.json
    ├── settings.json
    └── tasks.json

Extensions:

  • C/C++ Extension Pack by Microsoft (it installs C/C++, themes and CMake Tools)
  • Makefile Tools by Microsoft
  • Error Lens by Alexander
  • vscode-pdf by tomoki1207
  • EditorConfig for VS Code by EditorConfig
  • Better Comments by Aaron Bond (optional)
  • Excalidraw by pomdtr (optional - whiteboard for making schemes of algorithms, just create a file ending in .excalidraw)
  • Material Icon Theme by Philipp Kief (optional) (To enable it: CTRL + SHIFT + P -> Material Icons: Activate Icon Theme)

You can read the description for each of them to learn more and understand how to use

Setup formatter:

This is already set up if you copied the settings.json

In VS Code, open a .c file and press CTRL+SHIFT+P and type: Format Document With... > Configure Default Formatter... > C/C++

This should set it as the default formatter. Now you can use the same steps and select 'Format Document' (or just press CTRL+S).

How to run code?

Just press the triangle with the bug in the top right.

screenshot-1

You will see the output of the program in the Terminal tab at the bottom.

You can use breakpoints by clicking on the lines. You should see a red dot there. That is where your program will pause and let you inspect variables in the panel on the right. (you can see in the example n = 10)

screenshot-2

The reason you don't see any output is because the yellow line hasn't executed yet. You can continue execution of the program untill next breakpoint with the first option in the floating window that appeared. With the last option (red square stops the program)

P.S. I've disabled the yellow n=11 next to the code because it's sometimes confusing when it just shows the same value, even at declaration of n. (Behind the scenes the debuger just shows that memmory address of n, which is the same in all 3 places in the screenshot) For ease of undersanding just use the right pannel, it's more intuitive check the comment to enable it again

Shortcuts I use daily:

  • CTRL + / - comment in/out current line
  • CTRL + S - format file with the default formatter
  • CTRL + [ and CTRL + ] - to change indentation of line or multiple lines
  • CTRL + F - find text in current file
  • CTRL + P - open a file
  • CTRL + SHIFT + P - command palette
  • CTRL + TAB - change between tabs

Less used but still useful sometimes:

  • CTRL + B - show/hide explorer
  • CTRL + SHIFT + F - show/hide search
  • CTRL + ` - show/hide terminal

All shortcuts here: vscode shortcuts

Links:

https://github.com/andre1ut/AjutorTemePCLP (some helpful tips for pclp homework checker)

https://ocw.cs.pub.ro/courses/programare/coding-style (the rules for the pclp coding style)

https://github.com/torvalds/linux/blob/master/.clang-format (here is the official linux kernel format config)

Extra for advanced users that use git windows & linux: (ignore if you don't develop on windows)

On Windows (convert LF -> CRLF on checkout, CRLF -> LF on commit) git config --global core.autocrlf true

On Linux/macOS users (don't touch line endings, keep LF) git config --global core.autocrlf input

dyno@ragnarok:~/pclp$ nano .gitattributes
# Set default behavior for text files
* text=auto

(CTRL+X and Y to save)

dyno@ragnarok:~/pclp$ git add --renormalize .
dyno@ragnarok:~/pclp$ git commit -m "Normalize line endings"

About

minimal PCLP vscode configuration

Topics

Resources

Stars

Watchers

Forks