Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Apex Smart CleanerNew to Visual Studio Code? Get it now.
Apex Smart Cleaner

Apex Smart Cleaner

OmkarSanap

|
1 install
| (0) | Free
Automatically clean Salesforce Apex code on save
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Apex Smart Cleaner

Clean Apex Code. Generate Technical Documentation. Improve Salesforce Code Quality.

Apex Smart Cleaner is a Visual Studio Code extension designed to automatically clean Salesforce Apex code and generate technical documentation whenever an Apex file is saved.

It helps Salesforce developers maintain cleaner, more readable, and better-documented Apex classes and triggers.


Features

1. Automatic Apex Code Cleanup

Automatically executes when an Apex file is saved.

Features include:

  • Removes unnecessary System.debug() statements.
  • Removes trailing whitespace.
  • Removes excessive blank lines.
  • Removes unnecessary leading and trailing whitespace.
  • Preserves existing Apex business logic wherever the cleanup rules permit.

2. Intelligent Technical Documentation Generator

Automatically generates technical documentation for Apex components.

Class Documentation

Generates documentation containing:

  • Component name
  • Component type
  • Intelligent component description

Example:

/**

  • Technical Documentation
  • Component: AccountService
  • Type: CLASS
  • Description: Provides business services and Salesforce
  • data processing operations for AccountService. */ public class AccountService { }

Method Documentation

Automatically generates method descriptions based on method names and code implementation.

Supported documentation includes:

  • Method description
  • Parameter descriptions
  • Return type descriptions

Example:

/**

  • Creates new Salesforce records using DML insert operations.
  • @param account Account record or account-related information.
  • @return List Returns the result generated by the method. */ public List createAccount(Account account) { return new List(); }

Intelligent Method Description Detection

Identifies common Apex operations, including:

| Apex Operation | Generated Description | | HTTP Callout | External system communication | | Database.insert | Salesforce record insertion | | Database.update | Salesforce record updates | | Database.delete | Salesforce record deletion | | SOQL | Salesforce record retrieval | | Queueable Apex | Asynchronous processing | | Future Methods | Asynchronous execution | | JSON.serialize | JSON serialization | | JSON.deserialize | JSON deserialization | | addError() | Business rule validation | | Event Publishing | Salesforce event publishing |

3. Supported Apex Components

| Component | Support | | Apex Classes | Yes | | Apex Interfaces | Yes | | Apex Enums | Yes | | Apex Triggers | Yes | | Apex Methods | Yes | | Method Parameters | Yes | | Method Return Types | Yes |

Existing documentation immediately before a declaration is checked to avoid generating duplicate documentation.

4. Automatic Output Panel Refresh

The extension provides a dedicated VS Code Output channel:

Apex Smart Cleaner

The Output panel displays the latest execution report after every Apex file save.

It refreshes even when the file is saved without making code changes.

Output Report Includes:

| Report Information | Description | | File Name | Current Apex file name | | Characters Before | Original character count | | Characters After | Final character count | | System.debug Removed | Characters removed during debug cleanup | | Whitespace Removed | Characters removed during whitespace cleanup | | Total Characters Removed | Total character difference | | Documentation Added | Number of documentation blocks generated | | Cleanup Status | Cleanup execution status | | Documentation Status | Documentation generation status | | File Save Status | Save status | | Last Updated | Latest report timestamp |

5. Manual Apex Cleanup

Developers can also execute the cleanup command manually.

Command:

Apex Cleaner: Clean Apex Code

Command ID:

apexCleaner.clean

The command cleans the active Apex file, generates documentation, saves the file, and refreshes the Output panel through the save event.


Execution Flow

Developer Saves Apex File | v Check Apex File Extension | v Remove System.debug() | v Remove Unnecessary Whitespace | v Generate Class Documentation | v Generate Method Documentation | v Generate Trigger Documentation | v Apply Changes Before Save | v Save Apex File | v Refresh Output Panel | v Display Latest Cleanup Report


Supported File Types

| File Type | Extension | | Apex Class | .cls | | Apex Trigger | .trigger |

The extension also checks the VS Code language identifier for Apex files.


How to Use

Automatic Cleanup

  1. Open a Salesforce Apex .cls or .trigger file.
  2. Press Ctrl + S on Windows/Linux or Cmd + S on Mac.
  3. Apex Smart Cleaner executes automatically.
  4. Unnecessary debug statements and whitespace are removed.
  5. Technical documentation is generated where applicable.
  6. The Apex file is saved.
  7. The Output panel displays the latest execution report.

Manual Cleanup

  1. Open an Apex file.
  2. Open the VS Code Command Palette.
  3. Search for Apex Cleaner: Clean Apex Code.
  4. Execute the command.
  5. View the latest report in the Output panel.

View Cleanup Report

  1. Open the VS Code menu.
  2. Select View → Output.
  3. Select Apex Smart Cleaner from the Output channel dropdown.

Requirements

  • Visual Studio Code
  • Node.js (for extension development)
  • Salesforce Apex project
  • Apex .cls and .trigger files

Future Enhancements

Potential future improvements include:

  • Live VS Code sidebar dashboard.
  • Apex class and method statistics.
  • SOQL query counter.
  • DML operation counter.
  • Method complexity analysis.
  • Unused variable detection.
  • Apex PMD integration.
  • Configurable cleanup rules.
  • Code quality score.
  • Exportable technical documentation.

Version Information

Extension Name: Apex Smart Cleaner

Version: 1.0.2

Language: JavaScript

Platform: Visual Studio Code

Technology: VS Code Extension API


License

MIT License


Apex Smart Cleaner

Write Clean Apex. Generate Smart Documentation. Build Better Salesforce Applications.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft