Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 21 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,38 @@
# FastAPI VS Code Extension
# FastAPI extension for Visual Studio Code

A VS Code extension for FastAPI development that discovers and displays your API endpoints in a tree view.
A Visual Studio Code extension for FastAPI application development. Available on the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=FastAPILabs.fastapi).

## Features
## Overview

- **Automatic discovery** of FastAPI routes and routers from your codebase
- **Tree view** showing all endpoints organized by router hierarchy
- **Quick navigation** - click any route to jump to its definition
- **Smart search** - search and filter routes by path, method, or name
- **CodeLens integration** - navigate from test client calls (e.g., `client.get('/items')`) directly to route definitions
- **Multi-root workspace support** - discovers apps in all workspace folders
This extension enhances the FastAPI development experience in Visual Studio Code by providing:

## Settings
### Endpoint Explorer

| Setting | Description | Default |
|---------|-------------|---------|
| `fastapi.entryPoint` | Path to the main FastAPI application file (e.g., `src/main.py`). If not set, the extension searches common locations: `main.py`, `app/main.py`, `api/main.py`, `src/main.py`, `backend/app/main.py`. | `""` (auto-detect) |
| `fastapi.showTestCodeLenses` | Show CodeLens links above test client calls (e.g., `client.get('/items')`) to navigate to the corresponding route definition. | `true` |

**Note:** Currently the extension discovers one FastAPI app per workspace folder. If you have multiple apps, use separate workspace folders or configure `fastapi.entryPoint` to point to your primary app.
The Endpoint Explorer provides a hierarchical tree view of all FastAPI routes in your application. You can expand routers to see their associated endpoints, and click on any route to jump directly to its definition in the code. You can also jump to router definitions by right-clicking on a router node.

## Development
![Endpoint Explorer GIF](media/walkthrough/endpoints.gif)

### Prerequisites
### Search for routes

- [Bun](https://bun.sh) installed
- VS Code
Using ctrl+shift+E (cmd+shift+E on Mac), you can open the Command Palette and quickly search for routes by path, method, or name.

### Setup
![Search Routes GIF](media/walkthrough/search.gif)

1. Install dependencies:
```bash
bun install
```
### CodeLens for test client calls

2. Build the extension:
```bash
bun run compile
```
CodeLens links appear above HTTP client calls like `client.get('/items')`, letting you jump directly to the matching route definition.

3. Press `F5` to open a new window with your extension loaded
![CodeLens GIF](media/walkthrough/codelens.gif)

### Scripts
## Settings and customization

- `bun run compile` - Compile the extension
- `bun run watch` - Watch for changes and recompile
- `bun run package` - Package the extension into a .vsix file
- `bun run publish` - Publish the extension to the marketplace

## Project Structure
| Setting | Description | Default |
|---------|-------------|---------|
| `fastapi.entryPoint` | Path to the main FastAPI application file (e.g., `src/main.py`). If not set, the extension searches common locations: `main.py`, `app/main.py`, `api/main.py`, `src/main.py`, `backend/app/main.py`. | `""` (auto-detect) |
| `fastapi.showTestCodeLenses` | Show CodeLens links above test client calls (e.g., `client.get('/items')`) to navigate to the corresponding route definition. | `true` |

- `src/extension.ts` - Extension entry point
- `esbuild.js` - esbuild configuration
- `package.json` - Extension manifest
- `tsconfig.json` - TypeScript configuration
**Note:** Currently the extension discovers one FastAPI app per workspace folder. If you have multiple apps, use separate workspace folders or configure `fastapi.entryPoint` to point to your primary app.

## Technologies
## License

- TypeScript
- esbuild
- Bun (package manager)
- VS Code Extension API
MIT