Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Objective-C Include FixerNew to Visual Studio Code? Get it now.
Objective-C Include Fixer

Objective-C Include Fixer

krxk

|
1 install
| (0) | Free
Replaces #include with #import in git diff for .m and .mm files.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Objective-C Git Diff #include Fixer

Extension Icon

Automatically finds and replaces C-style #include with the correct #import in Objective-C files (.m, .mm) that you've changed in your Git repository.

This extension helps maintain code consistency in Objective-C projects by ensuring all header inclusions use the standard @import or #import directive, but it only acts on the files you are currently working on, as detected by git diff.


Features

  • Git-Aware: Only scans files listed in your Git working tree changes or staged changes. No unnecessary processing of your entire project.
  • Smart Repository Detection: If you have multiple projects in your workspace, it intelligently targets the repository of your currently active file. If no file is open, it will scan all repositories.
  • One-Command Operation: A single command fixes all relevant files.
  • Safe Replacements: Only replaces #include directives found in added lines of your diff, preventing accidental changes to untouched code.
  • File-Specific: Works exclusively on .m and .mm files.

How to Use

  1. Make changes to one or more .m or .mm files in your Git-managed project.
  2. Save the files. You will see them appear in VS Code's Source Control panel.
  3. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac).
  4. Type or select "Fix #include to #import in Git Diff".
  5. The extension will instantly apply the changes to all modified lines across all relevant files.

How It Works

The extension leverages VS Code's built-in Git API to:

  1. Identify the current Git repository based on the active text editor.
  2. Request a diff of all modified .m and .mm files against the HEAD commit.
  3. Parse the diff to find lines that were added (+).
  4. If an added line contains a #include, it creates a workspace edit to replace it with #import.
  5. Finally, it applies all edits in a single, atomic operation.

Requirements

  • Visual Studio Code version 1.75 or newer.
  • Your project must be a Git repository.
  • The built-in vscode.git extension must be enabled (it is by default).

Release Notes

1.0.0

Initial release of the "Objective-C Git Diff #include Fixer".


Enjoy a cleaner and more consistent Objective-C codebase!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft