Skip to content

Releases: sakhadib/auto-indent

White Space And Better Readability Format

Choose a tag to compare

@sakhadib sakhadib released this 05 Mar 21:06

Auto Indent - Smart Code Formatting for VS Code

A lightweight VS Code extension that automatically fixes code indentation for any programming language while respecting your editor preferences.

Features ✨

  • Smart Indentation: Automatically adjusts the indentation of your code based on your editor settings.
  • Multi-Language Support: Works with any programming language that VS Code supports.
  • Batch Formatting: Format multiple selections at once.
  • Customizable: Uses your editor settings for tab size, spaces, and indentation detection.
  • Lightweight: No external dependencies or complex configurations.
  • Cross-Platform: Works on Windows, macOS, and Linux.
  • Open Source: MIT License
  • Privacy-Focused: No data collection or telemetry.

Functionality πŸš€

  1. Indent your code based on your editor settings:
    • Tab size
    • Insert spaces
    • Detect indentation
  2. Detects missplaced brackets, braces, and parentheses and fixes them.
  3. Add white lines between code blocks for better readability after
    • blocks of code like if, else, for, while, switch, etc.
    • function definitions
    • class definitions

Installation πŸ“¦

  1. Download the vcix file from the releases page
  2. Open VS Code
  3. Go to Extensions (Ctrl+Shift+X)
  4. Click on the 3 dots in the top right corner
  5. Click on Install from VSIX
  6. Select the vcix file you downloaded
  7. Reload VS Code

Usage πŸ› οΈ

Basic Commands

  • Command Palette (Ctrl+Shift+P/Cmd+Shift+P):
    • Type "Fix Indentation" and press Enter
  • Keyboard Shortcut:
    • Ctrl+Alt+I (Windows/Linux)
    • Cmd+Opt+I (Mac)
  • Context Menu:
    • Right-click in editor β†’ "Fix Indentation"

Supported Scenarios

  • Format entire document (when no text selected)
  • Format specific selection (highlight text first)
  • Batch format multiple selections

Configuration βš™οΈ

The extension automatically uses your VS Code settings:

{
    "editor.tabSize": 4,
    "editor.insertSpaces": true,
    "editor.detectIndentation": true
}

Demo πŸŽ₯

A messy C code snippet before formatting:

#include<stdio.h>
int add(int a, int b){
return a + b;
}
int Main(){
int MyVariable = 5;
float FloatingPointVariable = 3.14;
for(int i=0; i<10; i++){
printf("i = %d\n", i); 
if(i==5){ 
printf("i is 5\n");
}
}
if(5>10){
printf("5 is grater");
}
while(1){
printf("Infinite loop\n");
}
}

after pressing Ctrl+Alt+I:

#include<stdio.h>

int add(int a, int b)
{
    return a + b;
}

int Main()
{
    int MyVariable = 5;
    float FloatingPointVariable = 3.14;
    
    for(int i=0; i<10; i++)
    {
        printf("i = %d\n", i); 
        
        if(i==5)
        {
            printf("i is 5\n");
        }
    }
    
    if(5>10)
    {
        printf("5 is grater");
    }
    
    while(1)
    {
        printf("Infinite loop\n");
    }
}

Contributing 🀝

Contributions are welcome! Feel free to open an issue or submit a pull request.

License πŸ“

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) [2025] [Adib Sakhawat]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

v0.0.2

Choose a tag to compare

@sakhadib sakhadib released this 03 Mar 20:23

Auto Indent v0.0.2

We're excited to announce the initial release of Auto Indent - your new best friend for clean, consistent code formatting!

What's New ✨

Core Features

  • πŸŽ‰ Initial Release: First stable version of Auto Indent
  • 🧹 Automatic indentation correction for entire files or selections
  • 🌐 Language-agnostic support for all programming languages
  • βš™οΈ Full compatibility with VS Code indentation settings

Technical Improvements

  • πŸš€ Optimized performance for large files
  • πŸ› οΈ Robust error handling and user feedback
  • πŸ“¦ Lightweight package with zero dependencies

Getting Started πŸš€

  1. Download the latest .vsix from the release assets

  2. Install in VS Code:

    code --install-extension auto-indent-0.0.2.vsix
  3. Use via:

    • Command Palette: "Fix Indentation"
    • Keyboard shortcut: Ctrl+Alt+I / Cmd+Opt+I
    • Right-click context menu

Known Issues ⚠️

  • May not handle minified code perfectly
  • Performance may degrade with extremely large files (>10k lines)
  • Some edge cases with mixed indentation styles

Changelog πŸ“

Added

  • Initial extension implementation
  • Core indentation logic
  • User preference integration
  • Notification system

Fixed

  • Mixed indentation handling
  • Selection edge cases
  • Performance optimizations

What's Next? 🚧

  • Multi-root workspace support
  • Customizable indentation rules
  • Format-on-save integration
  • Language-specific enhancements

Version 0.0.1

Choose a tag to compare

@sakhadib sakhadib released this 03 Mar 20:17

Auto Indent v0.0.1

We're excited to announce the initial release of Auto Indent - your new best friend for clean, consistent code formatting!

What's New ✨

Core Features

  • πŸŽ‰ Initial Release: First stable version of Auto Indent
  • 🧹 Automatic indentation correction for entire files or selections
  • 🌐 Language-agnostic support for all programming languages
  • βš™οΈ Full compatibility with VS Code indentation settings

Technical Improvements

  • πŸš€ Optimized performance for large files
  • πŸ› οΈ Robust error handling and user feedback
  • πŸ“¦ Lightweight package with zero dependencies

Getting Started πŸš€

  1. Download the latest .vsix from the release assets

  2. Install in VS Code:

    code --install-extension auto-indent-0.0.1.vsix
  3. Use via:

    • Command Palette: "Fix Indentation"
    • Keyboard shortcut: Ctrl+Alt+I / Cmd+Opt+I
    • Right-click context menu

Known Issues ⚠️

  • May not handle minified code perfectly
  • Performance may degrade with extremely large files (>10k lines)
  • Some edge cases with mixed indentation styles

Changelog πŸ“

Added

  • Initial extension implementation
  • Core indentation logic
  • User preference integration
  • Notification system

Fixed

  • Mixed indentation handling
  • Selection edge cases
  • Performance optimizations

What's Next? 🚧

  • Multi-root workspace support
  • Customizable indentation rules
  • Format-on-save integration
  • Language-specific enhancements