Competitive Code Refactor – A VS Code Extension for Macro-Free C++ Code

Правка en2, от shohag.shadow, 2025-02-07 14:12:59

Reading macro-heavy C++ code can be frustrating, especially for beginners. Competitive programmers often use macros to shorten code, but this can make solutions difficult to read and understand.

Wouldn’t it be easier if macros were automatically replaced with standard C++ for easier understanding? That’s exactly what Competitive Code Refactor, a free VS Code extension, does.

Competitive Code Refactor is a VS Code extension that automatically expands macros into standard C++ syntax, making code more readable.

Key Features:
1. Replaces macros with equivalent C++ loops and expressions.
2. Removes unnecessary #define lines for a cleaner codebase.
3. One-click refactoring with a dedicated button in the VS Code sidebar.

Why Use It?
Many competitive programmers use macros to write concise code, but:
- Beginners struggle to understand them.
- Debugging becomes harder when macros obscure logic.
- Reading others' code can be challenging.

How to Install
Installing the extension is simple:
1. Open VS Code.
2. Go to the Extensions panel (**Ctrl + Shift + X**).
3. Search for "Competitive Code Refactor".
4. Click Install.

Example Usage

Before Refactoring:

#define rep(i, a, b) for(int i = a; i < (b); i++)  
rep(i, 0, n) cin >> a[i]; 

After Refactoring:

for(int i = 0; i < (n); i++) cin >> a[i]; 

No more manually expanding macros—just click and refactor!

Try It and Share Your Feedback

Link of extension : Competetive Code Refactor

How to use?
After installing follow the figure.
Image about how to use this extention

Have suggestions? Found a bug? Let me know in the comments! Your feedback is valuable.

Теги macros, cpp, codeforces tools, tools, vscode extension, vscode, extensions, code readability, refactoring, productivity, debugging

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский shohag.shadow 2025-02-07 14:12:59 3 Tiny change: 'nt i = 0; I < (n); i+' -> 'nt i = 0; i < (n); i+'
en1 Английский shohag.shadow 2025-02-07 14:11:56 2067 Initial revision (published)