|
1 | | -# FastAPI VS Code Extension |
| 1 | +# FastAPI extension for Visual Studio Code |
2 | 2 |
|
3 | | -A VS Code extension for FastAPI development that discovers and displays your API endpoints in a tree view. |
| 3 | +A Visual Studio Code extension for FastAPI application development. Available on the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=FastAPILabs.fastapi). |
4 | 4 |
|
5 | | -## Features |
| 5 | +## Overview |
6 | 6 |
|
7 | | -- **Automatic discovery** of FastAPI routes and routers from your codebase |
8 | | -- **Tree view** showing all endpoints organized by router hierarchy |
9 | | -- **Quick navigation** - click any route to jump to its definition |
10 | | -- **Smart search** - search and filter routes by path, method, or name |
11 | | -- **CodeLens integration** - navigate from test client calls (e.g., `client.get('/items')`) directly to route definitions |
12 | | -- **Multi-root workspace support** - discovers apps in all workspace folders |
| 7 | +This extension enhances the FastAPI development experience in Visual Studio Code by providing: |
13 | 8 |
|
14 | | -## Settings |
| 9 | +### Endpoint Explorer |
15 | 10 |
|
16 | | -| Setting | Description | Default | |
17 | | -|---------|-------------|---------| |
18 | | -| `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) | |
19 | | -| `fastapi.showTestCodeLenses` | Show CodeLens links above test client calls (e.g., `client.get('/items')`) to navigate to the corresponding route definition. | `true` | |
20 | | - |
21 | | -**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. |
| 11 | +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. |
22 | 12 |
|
23 | | -## Development |
| 13 | + |
24 | 14 |
|
25 | | -### Prerequisites |
| 15 | +### Search for routes |
26 | 16 |
|
27 | | -- [Bun](https://bun.sh) installed |
28 | | -- VS Code |
| 17 | +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. |
29 | 18 |
|
30 | | -### Setup |
| 19 | + |
31 | 20 |
|
32 | | -1. Install dependencies: |
33 | | - ```bash |
34 | | - bun install |
35 | | - ``` |
| 21 | +### CodeLens for test client calls |
36 | 22 |
|
37 | | -2. Build the extension: |
38 | | - ```bash |
39 | | - bun run compile |
40 | | - ``` |
| 23 | +CodeLens links appear above HTTP client calls like `client.get('/items')`, letting you jump directly to the matching route definition. |
41 | 24 |
|
42 | | -3. Press `F5` to open a new window with your extension loaded |
| 25 | + |
43 | 26 |
|
44 | | -### Scripts |
| 27 | +## Settings and customization |
45 | 28 |
|
46 | | -- `bun run compile` - Compile the extension |
47 | | -- `bun run watch` - Watch for changes and recompile |
48 | | -- `bun run package` - Package the extension into a .vsix file |
49 | | -- `bun run publish` - Publish the extension to the marketplace |
50 | | - |
51 | | -## Project Structure |
| 29 | +| Setting | Description | Default | |
| 30 | +|---------|-------------|---------| |
| 31 | +| `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) | |
| 32 | +| `fastapi.showTestCodeLenses` | Show CodeLens links above test client calls (e.g., `client.get('/items')`) to navigate to the corresponding route definition. | `true` | |
52 | 33 |
|
53 | | -- `src/extension.ts` - Extension entry point |
54 | | -- `esbuild.js` - esbuild configuration |
55 | | -- `package.json` - Extension manifest |
56 | | -- `tsconfig.json` - TypeScript configuration |
| 34 | +**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. |
57 | 35 |
|
58 | | -## Technologies |
| 36 | +## License |
59 | 37 |
|
60 | | -- TypeScript |
61 | | -- esbuild |
62 | | -- Bun (package manager) |
63 | | -- VS Code Extension API |
| 38 | +MIT |
0 commit comments