C++ Playground: Run Inline REPL + Linter + Formatter + Compiler + Cloud + Visualizer + Intellisense + Error Lens + Essentials
A vscode extension that runs .cpp files while typing, providing line-by-line outputs as well as error logs inside the editor (both cloud and locally). Includes other features like linting, formatting, cloud compiling, realtime visualization, intellisense, error checking and more...
More features below
- Open a
.cppfile and you will see outputs besidecoutandidentifierstatements. - Automatically starts on
.cppfiles (For Manual Activation, Read Next Section) - Input must come from txt files or buffer. (See Below (Input/Output))
-
Mode: Status bar item
π/π»indicates whether cloud compiler or local compiler (g++command) is being used -
Format:
alt+shift+fto format the file. (Gets set as cpp formatter by default after installation, if you have multiple formatter extensions, you can change it in settings or incommand palettetypeFormat Document With...) -
Visualization: From Command Palette, search
C++ Playground:thenvisualize -
Others: Access other features from Command Palette:
Ctrl+Shift+PorF1and searchC++ Playground:thenformat,input,mode,start,etc -
Activation/Deactivation:
- Activate manually:
ctrl+alt+shift+n(Activated automatically on.cppfiles) - Deactivate manually:
ctrl+alt+shift+q - Click status bar item saying
CPP REPLto toggle between active and deactive state with a.cppfile open
- Activate manually:
-
You will need computation power to use the extension.
- Input statements like
cinandscanfmust be removed or hardcoded or stream must be altered (Or else you will get timeout after 10s). - Stream Alteration Example 1:
int main(){
freopen("input.txt", "r", stdin);
int x; std::cin >> x; // reads int from input.txt file
std::cout << x + 1;
}- Example 2:
#include<sstream>
int main() {
std::istringstream iss(R"(
3 line
input
example
)");
std::cin.rdbuf(iss.rdbuf()); // done
int x; std::cin >> x; // stores 3
std::cout << x + 1; // 4
}- You can also type
Ctrl+Shift+PorF1to open the command palette and search forInsert Input Hardcode Templateto automatically insert the hardcoded input at the start of main function.
- Open VSCode Extension tab (Shortcut:
ctrl+shift+X) and type 'cpp repl' - Install the extension named
C++ Playground: Inline REPL + Bla Bla Bla
- If you have any feature requests, feel free to join Discord (CodePlayground) or email me.
- Zero Configuration
- Executes the code as you type and shows outputs beside each line
- Prints complex data structures in pretty format
- Format code with
AStyle - Visualize runtime code execution in realtime
- Lints errors beside defective lines
- Shows compiled output in a separate panel (Can be turned off)
- Makes it easier to debug and view values of variables from within editor
- Can run using both cloud and local compilations (
g++for local as of now) - Lightweight and as fast as it gets
- If you use cloud compiler (default), it requires internet obvisously.
- Else if you're on offline mode (switch using status bar icon), it will require
C++compiler(g++)to be installed on your pc beforehand. - (On Cloud Mode) Compatible with code that use
C++14or below version (currently on servers) (might vary from time to time) - (On Local Mode) Compatible with code that use the
g++version that you have.
- [Easiest] To install
gcc(includesg++) on windows run (in powershell): With Scoop:OR with Chocolatey:Set-ExecutionPolicy Bypass -Scope Process -Force; iex "& {$(irm get.scoop.sh)} -RunAsAdmin"; scoop install gcc
Set-ExecutionPolicy Bypass -Scope Process -Force; iwr -useb https://chocolatey.org/install.ps1 | iex; choco install mingw -y
- For tutorial on how to install
C++compiler on your system, visit this link or contact me. - For Windows users, you can also use the Windows Subsystem for Linux to run
C++code - Verify using
g++ --version
- Status bar icon
π/π»used to switch between cloud and local compiler mode. - Delay after keystores: Look into settings.
- Auto open output panel: Look into settings.
Release Notes
Stable Release
- Repl, linting, formatting, cloud compiling, visualization, error checking, intellisense and other features completed
- Bugs fixed
A lot of improvements and bug fixes:
- Faster cloud compiler
- Improved user experience
- Settings options
- And much more ...
Reimplementation from scratch:
- Considerably better and faster parsing
Initial release of contains the following features:
- Runs lines of the C++ file as you type
- Shows output of the code beside each line
Enjoy!