Web2py IntelliSense
The VS Code extension that web2py never had. Why this existsweb2py injects This extension fixes all of it. It indexes your web2py project the way web2py itself sees it, and gives you the IDE experience every other framework gets out of the box. InstallFrom the Marketplace — Extensions panel → search Web2py IntelliSense → Install. Or from the command line:
Then open your web2py folder — the one containing Install from a
|
| You type | You get |
|---|---|
db. |
Every table in the current application |
db.employee. |
Fields with type, requires, and default value |
db['employee']. |
Same fields — subscript and call access resolve too |
record. |
Fields of the table a local .select().first() came from |
db[t][f]. |
Full Field API — belongs, lower, cast, contains, … |
Field( |
Kwarg completion — multiline-aware, filters already-used kwargs |
session. |
Every key assigned anywhere in the app, with file and line |
request.vars. |
Vars keys used across the app |
IS_IN_ |
All validators with signature and usage example |
app_settings. |
Keys from model settings containers |
TwoDimensionalView. |
Methods and attributes with full parameter list |
Field, DAL, Rows |
325+ pydal/gluon names with signatures, straight from the source |
Every completion item shows the signature and a one-line summary beside the label — you see what something does without opening the docs popup.
Local record variables are tracked across multiline statements, for row in rows: loops, and db[table_name] where table_name is a string literal.
Go to Definition (F12 / Ctrl+Click)
| Click on | Jumps to |
|---|---|
| A model function or class | Its definition in models/ |
| A table name | The define_table call |
| A validator or HTML helper | The line in pydal/validators.py or gluon/html.py |
| A settings key | The file and line where the key was assigned |
| A controller variable | Its assignment in the models |
| A controller string value | The controller file |
| Any pydal/gluon name | The source file |
Hover documentation
Hover any name for its full signature, all parameters, and the complete docstring — inherited docs included. Works across model code, pydal, gluon, validators, HTML helpers, and settings.
Diagnostics
- Name typos in red —
Fiel→ did you meanField? - Kwarg typos —
typ=→type - Syntax errors via Python's
ast.parse - Ctrl+. quick fixes — one keypress correction
- Star-import files are skipped — no false positives
Pylance integration
Automatically suppresses reportUndefinedVariable for web2py's injected globals. No more yellow underlines on db, session, auth, or T.
Built for large installations
Applications are indexed lazily — the first time you open a file in them, not all at once at startup. Diagnostics are debounced on save. A workspace with dozens of applications under applications/ stays responsive.
Coverage
The extension covers every name available at runtime in a web2py application.
| Source | Names | Method |
|---|---|---|
list_globals.py |
130+ | dir() over 21 gluon modules at startup |
list_api.py |
325+ | AST parse of pydal/gluon source — no imports needed |
list_members.py |
session, request, response, Field members | inspect on live objects |
| Indexer | tables, fields, model functions, settings containers | Static analysis of your code |
100% of what Python's dir() returns is known to the extension, with signatures and documentation.
Commands
| Command | What it does |
|---|---|
| Web2py: Rebuild Index | Re-indexes all applications in the workspace |
| Web2py: Scan All Files for Errors | Runs diagnostics across every .py file |
| Web2py: Show Index for This File | Prints every global, container, key and class member — debug tool for missing completions |
All accessible via Ctrl+Shift+P.
Requirements
- VS Code 1.85 or newer
- A web2py 2.x installation opened as the workspace root (the folder containing
applications/) - Python on
PATH— used for the startup introspection scripts
Architecture
src/
extension.ts activation, completion, hover, Go to Definition
parser.ts tables, fields, functions, classes, settings containers
indexer.ts one AppIndex per application, merges models + controllers + modules
diagnostics.ts name/kwarg typo detection, syntax errors
kwargcomplete.ts Field() / define_table() kwarg completion
quickfix.ts Ctrl+. code actions
scripts/
list_globals.py dir() over gluon → runtime names with signatures and docs
list_api.py ast walk over pydal/gluon source → every function/class/method
list_members.py members of session/request/response/Field via inspect
generate_stubs.py .pyi stub for Pylance
See DEVELOPMENT.md for the full developer guide.
Build from source
git clone https://github.com/IbraDevx/web2py-intellisense.git
cd web2py-intellisense
npm install
npx tsc -p ./
npx vsce package
This produces web2py-intellisense-<version>.vsix:
code --install-extension web2py-intellisense-0.18.0.vsix
Contributing
Issues and PRs welcome. Run the test suite before submitting:
node test-fixture/test-full-diagnostics.js
node test-fixture/test-precision.js
node test-fixture/test-functions.js
node test-fixture/test-members.js
node test-fixture/test-global-objects.js
node test-fixture/test-class-members.js
node test-fixture/test-api-extract.js
License
MIT — see LICENSE.
Developed by Ibrahem Darwish