# Codeflash VS Code Extension

[![VS Code Marketplace](https://img.shields.io/badge/VS%20Code-Marketplace-blue)](https://marketplace.visualstudio.com/items?itemName=codeflash.codeflash)
[![License: BSL-1.1](https://img.shields.io/badge/License-BSL%201.1-blue.svg)](https://github.com/codeflash-ai/codeflash/blob/main/codeflash/LICENSE)

**With [Codeflash](https://www.codeflash.ai), all the Python code you and your agents write can be always optimal. One-click optimization, automate optimization after every commit, and see optimization progress in real time, and more.**

Codeflash does everything that an expert performance engineer would do to find optimizations. It profiles your code, generates multiple optimization ideas, generates tests, and finds the fastest code that is correct and safe to merge.

## Features



- ⚡ **One-Click Optimization** - Find AI-generated optimizations easily with CodeLens hints 
- 📊 **Real-time Progress** - Track optimization progress with detailed status updates 
- ✨ **Inline Optimization Suggestions** - See optimization opportunities directly above function definitions  
- 🎯 **Smart Function Detection** - Automatically identifies optimizable Python functions
- 🔄 **Git Integration** - Optimize only changed functions with "Optimize Changed Functions"  
- 🎨 **Clean Interface** - Keeps you in the flow, finds optimizations in the background and stays out of your way until it finds and optimization.

## Requirements

- Python 3.9+
- Git repository (required)
- VS Code 1.94.0+

## Quick Start

1. Install the Codeflash extension from the Extension Marketplace
2. Follow the installation flow to initialize Codeflash
3. Open a Python file - Codeflash activates automatically
4. See `optimize` suggestions appear above optimizable functions
5. Click to optimize or use the sidebar to manage optimizations


## Usage

### Inline CodeLens

```python
 # optimize <- Click to optimize
def slow_function(data):
    result = []
    for item in data:
        if item in [1, 2, 3, 4, 5]:
            result.append(item * 2)
    return result
```

### Key Workflow

1. **Code normally** - Write and modify Python functions
2. **See suggestions** - Codeflash shows optimization opportunities
3. **Optimize selectively** - Choose which functions to improve
4. **Track progress** - Monitor optimizations in the sidebar
5. **Review changes** - View diffs and apply improvements

## Documentation

📖 **Complete Documentation**: https://docs.codeflash.ai/

**Key Resources**:

- [Getting Started Guide](https://docs.codeflash.ai/getting-started/local-installation)
- [How Codeflash Works](https://docs.codeflash.ai/codeflash-concepts/how-codeflash-works)

## Troubleshooting

**Extension won't activate?**

- Ensure you've run `codeflash init` in your project
- Verify Git repository exists (`.git` folder)
- Check Python 3.9+ is installed and in PATH

**No functions showing?**

- Open a `.py` file with functions
- Wait for analysis to complete
- Check VS Code Output → Codeflash for errors

**Need help?**

- View logs: `View → Output → Codeflash`
- Report issues: https://github.com/codeflash-ai/codeflash/issues
