CodeLens support for Flask CLI commands in VS Code. FlaskLens detects Flask
blueprint CLI commands (and optional inline hints) and lets you run them
directly from the editor.
Features
CodeLens for @bp.cli.command("name") decorators.
CodeLens for inline hints like # flask-cli: flask mycommand.
Runs commands in the active VS Code terminal (or creates one).
How It Works
FlaskLens scans Python files for:
Blueprint declarations like bp = Blueprint("admin", __name__)
CLI decorators like @bp.cli.command("seed")
Inline hints like # flask-cli: flask db upgrade
It then adds CodeLens entries at those locations to run the related CLI
command.
Quick Start
Install the extension from the VS Code Marketplace.
Open a Python file in your Flask project.
Hover above a CLI decorator or inline hint and click the CodeLens.
Examples
Blueprint CLI command:
from flask import Blueprint
bp = Blueprint("admin", __name__)
@bp.cli.command("seed")
def seed():
...
Inline CLI hint:
# flask-cli: flask db upgrade
Commands
FlaskLens: Open Route (flasklens.openRoute)
FlaskLens: Run CLI Command (flasklens.runCliCommand)