Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Import CollapserNew to Visual Studio Code? Get it now.
Import Collapser

Import Collapser

Tanay Kedia

|
44 installs
| (0) | Free
The Auto Collapse Imports extension enhances your development workflow by automatically collapsing all import statements when you open a file in Visual Studio Code. This feature minimizes visual clutter and keeps your codebase organized and easy to navigate.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Fix Your README.md

Edit your README.md to properly describe your Import Collapser extension.

1️⃣ Example Updated README.md

Here’s an improved version of your README:

# Import Collapser 🚀

**Import Collapser** is a **Visual Studio Code extension** that automatically **collapses all import statements** when you open a file, keeping your workspace clean and reducing clutter.

---

## ✨ Features

✔ **Auto-collapse imports** when opening a file.  
✔ **Manual collapse** using a command (`Collapse Imports`).  
✔ **Supports JavaScript & TypeScript** (`.js, .jsx, .ts, .tsx`).  
✔ **Configurable settings** to adjust behavior.  
✔ **Works with ES6, CommonJS, and TypeScript imports.**  
✔ **Lightweight and fast** – doesn't slow down your workflow.

### 📸 **Demo**

Before:
![Before](https://github.com/TanayK07/import-collapser/raw/HEAD/images/before.png)

After:
![After](https://github.com/TanayK07/import-collapser/raw/HEAD/images/after.png)

---

## ⚙️ Installation

You can install **Import Collapser** directly from the **VS Code Extensions Marketplace**:

1. Open **Visual Studio Code**.
2. Go to **Extensions** (`Ctrl+Shift+X`).
3. Search for **"Import Collapser"**.
4. Click **Install**.

Or install via the terminal:

```sh
code --install-extension import-collapser
```

```md
---

## 🛠️ Extension Settings

This extension adds the following settings to **VS Code**:

| Setting                                 | Description                                          | Default                  |
| --------------------------------------- | ---------------------------------------------------- | ------------------------ |
| `importCollapser.autoCollapseOnOpen`    | Automatically collapses imports when opening a file. | `true`                   |
| `importCollapser.autoCollapseOnSave`    | Automatically collapses imports when saving a file.  | `false`                  |
| `importCollapser.collapseCommentBlocks` | Also collapses large comment blocks (`/** ... */`).  | `false`                  |
| `importCollapser.excludePatterns`       | Ignore files matching these patterns.                | `["**/node_modules/**"]` |

---

## 📌 Commands

You can also manually trigger import collapsing using **VS Code Commands**:

| Command              | Description                                   |
| -------------------- | --------------------------------------------- |
| `Collapse Imports`   | Manually collapse imports in the active file. |
| `Uncollapse Imports` | Expand previously collapsed imports.          |

You can access these commands via **Command Palette** (`Ctrl+Shift+P` → Search "Import Collapser").

---

## 🚀 Usage

1. Open any JavaScript or TypeScript file (`.js, .jsx, .ts, .tsx`).
2. Watch as **Import Collapser** automatically collapses imports! 🎉
3. If needed, use **"Collapse Imports"** or **"Uncollapse Imports"** via the **Command Palette** (`Ctrl+Shift+P`).

---

## 📝 Known Issues

- If imports **don't collapse automatically**, check that `importCollapser.autoCollapseOnOpen` is **enabled** in your settings.
- If some import statements **don't collapse**, they may be using a format that VS Code doesn't recognize for folding.

---

## 📢 Release Notes

### **v1.0.0** (Initial Release)

✅ First release of **Import Collapser**! 🎉  
✅ Automatically collapses imports on file open.  
✅ Supports `.js, .jsx, .ts, .tsx` files.  
✅ Added **command palette options** for manual control.

### **v1.1.0** (Upcoming)

🚀 Add support for collapsing **console.log()** statements.  
🚀 Improve performance for large projects.

---

## 📄 License

**MIT License** – Free to use and contribute! ❤️

---

## 💡 Contributing

Want to improve **Import Collapser**? Feel free to contribute!

1. **Fork** this repository.
2. **Clone** it locally.
3. Submit a **Pull Request (PR)** with improvements.

📌 **GitHub Repo:** [Import Collapser on GitHub](https://github.com/TanayK07/import-collapser)

---

## 📞 Need Help?

If you encounter issues, report them [on GitHub Issues](https://github.com/TanayK07/import-collapser/issues).

Enjoy clean, clutter-free code with **Import Collapser**! 🚀🎉
```
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft