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.

Framework source ยท Markdown

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

  1. Open the Explorer sidebar (Ctrl+Shift+E).
  2. 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

  1. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on macOS).
  2. Run:
Flaxon: Run App
  1. 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

  1. Open the Command Palette.
  2. Run:
Flaxon: Debug App
  1. 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

  1. Enter the project name.
  2. Choose the project location.
  3. The extension generates a starter project containing:
project/
โ”œโ”€โ”€ app.py
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ .gitignore

Generate Route Workflow

  1. Enter the route path.

Example:

/api/users
  1. Select the HTTP method.

  2. GET

  3. POST
  4. PUT
  5. DELETE
  6. PATCH
  7. WebSocket

  8. (Optional) Enter a route name.

The extension generates a route file with boilerplate code.


Generate Schema Workflow

  1. Enter a schema name.

Example:

CreateUser
  1. 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

  1. Create a project.
  2. Define your routes.
  3. Use snippets and IntelliSense.
  4. View routes in the Route Explorer.
  5. Run the application.
  6. Debug when needed.
  7. 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

  1. Open the Output panel (Ctrl+Shift+U).
  2. Select Flaxon from the dropdown.
  3. 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! ๐Ÿš€