Flaxon 0.3.0 and Teloce-Py 0.3.0 are available on PyPI. Release instructions are maintained on this site; source links identify the framework snapshot. Check version and upgrade guidance.
Flaxon VS Code Extension - Features Guide
Overview
The Flaxon VS Code Extension provides a comprehensive set of features to supercharge your Flaxon development workflow.
๐ Route Explorer
What It Does
The Route Explorer displays all your Flaxon routes in a hierarchical tree view inside the VS Code Explorer sidebar, making it easy to navigate large projects.
How to Access
- Open the Explorer sidebar (
Ctrl+Shift+E). - Expand the Flaxon Routes section.
Features
| Feature | Description |
|---|---|
| Route Tree | Displays all routes grouped by file. |
| Method Icons | Color-coded HTTP methods (GET, POST, PUT, DELETE, PATCH, WS). |
| Click Navigation | Click any route to jump directly to its definition. |
| Auto Refresh | Updates automatically whenever files change. |
| Search | Filter routes by typing in the search box. |
Example Route Tree
Flaxon Routes
โโโ ๐ app.py
โ โโโ GET / (line 12)
โ โโโ GET /api/users (line 22)
โ โโโ POST /api/users (line 30)
โ โโโ WS /ws/chat (line 45)
โโโ ๐ auth.py
โ โโโ POST /api/auth/login (line 8)
โ โโโ POST /api/auth/logout (line 16)
โโโ ๐ admin.py
โโโ GET /admin (line 10)
HTTP Method Colors
| Method | Color | Icon |
|---|---|---|
| GET | ๐ข Green | โ |
| POST | ๐ Orange | + |
| PUT | ๐ต Blue | โ |
| DELETE | ๐ด Red | โ |
| PATCH | ๐ฃ Purple | โ |
| WebSocket | ๐ท Cyan | โ |
โก CodeLens
What It Does
CodeLens adds useful actions directly above your route handlers, allowing you to run, debug, or locate references without leaving the editor.
Features
| Button | Action |
|---|---|
| โถ Run | Execute the selected route handler. |
| ๐ Debug | Start debugging the selected route. |
| ๐ References | View all references to the route. |
Example
@app.get("/users/<int:user_id>")
# โถ Run ๐ Debug ๐ 3 References
async def get_user(user_id: int):
return {
"id": user_id,
"name": f"User {user_id}"
}
Visual Layout
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ @app.get("/users/<int:user_id>") โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โถ Run โ ๐ Debug โ ๐ 3 References โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ async def get_user(user_id: int): โ
โ return {"id": user_id, "name": f"User {user_id}"} โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ก Intelligent Completions
What It Does
The extension provides intelligent auto-completion for Flaxon APIs, decorators, validation classes, exceptions, and request objects as you type.
Completion Categories
| Context | Suggestions |
|---|---|
@app. |
get, post, put, delete, patch, websocket |
fields. |
String, Integer, Float, Boolean, Email, Choice, UUID, DateTime |
HTTPException( |
400, 401, 403, 404, 422, 500 |
request. |
json(), form(), body(), headers, query_params, path_params, cookies |
Schema |
Schema class templates and completions |
Example
Type:
@app.
Suggestions:
@app.get - GET route decorator
@app.post - POST route decorator
@app.put - PUT route decorator
@app.delete - DELETE route decorator
@app.patch - PATCH route decorator
@app.websocket - WebSocket route decorator
๐ Code Snippets
What They Do
Speed up development with built-in snippets for common Flaxon patterns.
Available Snippets
| Trigger | Description |
|---|---|
froute |
Complete GET route |
fpost |
POST route |
fws |
WebSocket endpoint |
fschema |
Schema class |
fvalidation |
Route with validation |
fmiddleware |
Middleware boilerplate |
fplugin |
Plugin template |
ftest |
Test case |
Example
Typing:
froute
Then pressing Tab generates:
@app.get("/api/users")
async def get_users(request):
"""Get all users."""
return {
"users": []
}
๐ Hover Documentation
What It Does
Hover over Flaxon APIs to view inline documentation, examples, and parameter descriptions.
Supported APIs
| API | Documentation |
|---|---|
@app.get |
Route usage and parameters |
@app.post |
Route usage and parameters |
@app.websocket |
WebSocket route documentation |
fields.StrField |
Field options and examples |
fields.IntField |
Integer field documentation |
HTTPException |
Status codes and usage |
Schema |
Schema documentation |
Example
@app.get("/users")
async def get_users():
return {"users": []}
Hovering over @app.get displays:
Flaxon GET Route
@app.get("/path")
async def handler(request):
return {"message": "Hello"}
Parameters
| Parameter | Description |
|---|---|
path |
Route path (for example, /users/<int:id>) |
name |
Optional route name |
๐ One-Click Run
What It Does
Run your Flaxon application with a single command directly from Visual Studio Code.
How to Use
- Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+Pon macOS). - Run:
Flaxon: Run App
- Your application starts automatically in the integrated terminal.
Features
| Feature | Description |
|---|---|
| Auto Reload | Reloads automatically when source files change. |
| Integrated Terminal | Displays application output inside VS Code. |
| Port Detection | Uses the configured port (default: 8000). |
| Entry Point Detection | Automatically detects app:app or prompts for an entry point. |
Configuration
{
"flaxon.entryPoint": "app:app",
"flaxon.debug.reload": true
}
๐ Integrated Debugging
What It Does
Debug Flaxon applications using the built-in Visual Studio Code debugger.
How to Use
- Open the Command Palette.
- Run:
Flaxon: Debug App
- The debugger launches with your application.
Debugging Features
| Feature | Description |
|---|---|
| Breakpoints | Pause execution anywhere in your code. |
| Variable Inspection | Inspect variables in real time. |
| Call Stack | View the current execution stack. |
| Watch Expressions | Monitor custom expressions while debugging. |
| Exception Handling | Automatically stop when exceptions occur. |
Debug Configuration
{
"name": "Flaxon: Debug App",
"type": "python",
"request": "launch",
"module": "flaxon",
"args": [
"run",
"app:app"
],
"console": "integratedTerminal"
}
๐ง Project Scaffolding
What It Does
Generate complete Flaxon projects and common project components with a few clicks.
Available Commands
| Command | Description |
|---|---|
| Flaxon: Create Project | Create a new Flaxon project. |
| Flaxon: Generate Route | Generate a new route module. |
| Flaxon: Generate Schema | Generate a validation schema. |
| Flaxon: Generate Plugin | Generate a new plugin template. |
Create Project Workflow
- Enter the project name.
- Choose the project location.
- The extension generates a starter project containing:
project/
โโโ app.py
โโโ pyproject.toml
โโโ README.md
โโโ requirements.txt
โโโ .gitignore
Generate Route Workflow
- Enter the route path.
Example:
/api/users
-
Select the HTTP method.
-
GET
- POST
- PUT
- DELETE
- PATCH
-
WebSocket
-
(Optional) Enter a route name.
The extension generates a route file with boilerplate code.
Generate Schema Workflow
- Enter a schema name.
Example:
CreateUser
- Add your fields.
For each field you can specify:
- Name
- Type
- Required status
- Default value
- Constraints (minimum, maximum, length, choices, etc.)
The extension generates the complete schema class automatically.
๐ Real-time Diagnostics
What It Does
Detects common Flaxon mistakes as you type and displays warnings or errors directly in the editor.
Diagnostics
| Diagnostic | Description |
|---|---|
| Missing Import | from flaxon import Flaxon not found. |
| Missing Application | app = Flaxon() not defined. |
| Async Handler | Route handlers should be asynchronous. |
| Missing Return | Route handlers should return a response. |
| WebSocket Accept | Missing await socket.accept(). |
| Validation Imports | Missing validation imports. |
| Exception Imports | Missing HTTPException import. |
Example
@app.get("/users")
def get_users():
return {"users": []}
Diagnostics:
โ Route handler should be async.
โ Missing return type annotation.
๐จ Syntax Highlighting
What It Does
Provides syntax highlighting specifically designed for Flaxon applications.
Highlighted Elements
| Element | Highlight |
|---|---|
| Route Decorators | @app.get, @app.post |
| Path Parameters | <int:user_id> |
| Schema Fields | fields.StrField |
| HTTP Exceptions | HTTPException |
| WebSockets | @app.websocket |
| Validation | Schema, required=True |
๐ Command Reference
Available Commands
| Command | Description | Shortcut |
|---|---|---|
| Flaxon: Create Project | Create a new project | โ |
| Flaxon: Run App | Run the application | Ctrl+Shift+F5 |
| Flaxon: Debug App | Start debugging | โ |
| Flaxon: Generate Route | Generate a route | โ |
| Flaxon: Generate Schema | Generate a schema | โ |
| Flaxon: Generate Plugin | Generate a plugin | โ |
| Flaxon: Show Routes | Open Route Explorer | Ctrl+Shift+R |
| Flaxon: Open Documentation | Open documentation | โ |
| Flaxon: Restart Language Server | Restart the language server | โ |
โ๏ธ Configuration Settings
Available Settings
| Setting | Default | Description |
|---|---|---|
flaxon.pythonPath |
python3 |
Python interpreter path |
flaxon.entryPoint |
app:app |
Application entry point |
flaxon.enableRouteExplorer |
true |
Enable Route Explorer |
flaxon.enableCodeLens |
true |
Enable CodeLens |
flaxon.enableDiagnostics |
true |
Enable diagnostics |
flaxon.enableCompletions |
true |
Enable IntelliSense |
flaxon.trace.server |
off |
Language Server trace level |
flaxon.debug.reload |
true |
Auto reload application |
flaxon.snippets.enable |
true |
Enable snippets |
Example Configuration
{
"flaxon.pythonPath": "python3.11",
"flaxon.entryPoint": "main:app",
"flaxon.enableRouteExplorer": true,
"flaxon.enableCodeLens": true,
"flaxon.enableDiagnostics": true,
"flaxon.enableCompletions": true,
"flaxon.trace.server": "verbose",
"flaxon.debug.reload": true,
"flaxon.snippets.enable": true
}
๐ฏ Best Practices
Recommended Workflow
- Create a project.
- Define your routes.
- Use snippets and IntelliSense.
- View routes in the Route Explorer.
- Run the application.
- Debug when needed.
- Generate additional components using the scaffolding commands.
Tips
- โ Keep the Route Explorer open while developing.
- โ Use snippets to reduce repetitive code.
- โ Enable diagnostics for instant feedback.
- โ Use the debugger to investigate complex issues.
- โ Save files frequently to refresh routes automatically.
๐ Troubleshooting
Common Issues
| Issue | Solution |
|---|---|
| Extension not activating | Open a Python file containing Flaxon code. |
| Route Explorer empty | Save the file and ensure routes use @app.* decorators. |
| CodeLens missing | Enable flaxon.enableCodeLens. |
| Auto-completion missing | Enable flaxon.enableCompletions. |
| Language Server not starting | Verify Python and Flaxon are installed. |
| Debugging unavailable | Install the Python extension and debugger. |
Checking Logs
- Open the Output panel (
Ctrl+Shift+U). - Select Flaxon from the dropdown.
- Review any logged errors or warnings.
Reporting Issues
When opening an issue, include:
- VS Code version
- Operating system
- Python version
- Flaxon version
- Extension version
- Steps to reproduce the issue
- Output panel logs
- Screenshots (if applicable)
Happy coding with Flaxon! ๐