Ren'Py IntelliSenseVS Code / Cursor extension for Licensed under the MIT License. Release history: CHANGELOG. What's New in 1.3.0
Setup (avoid Python / Pylance on
|
| Setting | Default | Description |
|---|---|---|
renpyDocHover.fetchOnline |
true |
Fetch documentation from renpy.org (needs network) |
renpyDocHover.cacheSize |
400 |
Number of fetched pages to cache in memory |
renpyDocHover.preferLocalDocstring |
true |
Show your docstrings when available |
renpyDocHover.showOnlineDocsWithLocal |
true |
Show online docs alongside local docstrings |
Writing Docstrings
The extension recognizes docstrings in several formats.
Triple-Quoted Strings (Python style)
def add_event(self, *events):
"""
Adds events to storage.
@param events: Events to add
"""
class MyScreen:
'''Short class doc.'''
Comment Blocks Above Variables
Comment blocks directly above variable definitions are treated as docstrings:
# Configuration for the main character.
# Controls appearance and behavior.
define mc = Character("Alex")
# Tracks whether the player has completed the tutorial.
default tutorial_done = False
Ren'Py Script Comments
For code outside python: blocks, use # comments:
# """
# This is a docstring for the label below.
# """
label start:
pass
Or use consecutive # lines as a plain comment block.
Supported Definition Types
| Kind | Example |
|---|---|
| Function | def name( / async def name( |
| Class | class Name: |
| Label | label name: |
| Define | define name = |
| Default | default name = |
| Screen | screen name: |
| Transform | transform name: |
| Image | image name |
| Variable | name = (plain Python assignment) |
Docstring Formatting
The extension converts your docstrings to Markdown for display.
Section Headers
These are rendered as bold headings:
Args:, Parameters:, Returns:, Yields:, Raises:, Note:, Warning:, Example:, Attributes:, See Also:
Epydoc Tags
| Tag | Rendered as |
|---|---|
@param name desc |
Bullet with name |
@returns desc |
Returns: ... |
@raises Exc desc |
Bullet with Exc |
@type name desc |
Type line for name |
Code Formatting
- Double backticks:
``code``→`code` - Single backticks work as normal Markdown
- Lines starting with
>>>are wrapped in code fences
Cross-Reference Links
Sphinx-Style Roles
Reference other code in your docstrings with clickable links:
def push_screen(self):
"""
See :class:`MyOverlay` and :func:`restore_screen` for pairing.
Uses :meth:`FragmentStorage.add_event` internally.
"""
Ctrl+click / Cmd+click links to jump to the definition.
Flexible Syntax
Cross-references support various signature formats:
| Syntax | Result |
|---|---|
:func:`get_name` |
get_name (linked) |
:func:`get_name()` |
get_name (linked) + () |
:func:`get_name() -> str` |
get_name (linked) + () -> str |
:func:`add(event: :class:`Event`)` |
add (linked) + (event: + Event (linked) + ) |
Only the symbol name becomes the link; parameters and return types are plain text with their own nested links.
Class-Aware Resolution
Inside a class or method docstring, unqualified names automatically resolve to that class's members:
class EventStorage:
"""
Storage for events.
Methods:
- :func:`add_event()` - adds an event # Resolves to EventStorage.add_event
- :func:`get_events()` - retrieves all # Resolves to EventStorage.get_events
"""
Qualified Names
For duplicate names or cross-class references, use the full path:
| Pattern | Meaning |
|---------|---------|
| :meth:FragmentStorage.add_event | Method on specific class | | `:class:`Outer.Inner | Nested class |
Workspace Index
The extension indexes all .rpy / .rpym files in your workspace. The index updates when files are opened, saved, or deleted.
Limitations
- Cross-refs use the workspace index; unsaved changes in other files may be stale until saved
- Complex same-line decorators with nested parentheses may not be detected; put decorators on separate lines
- Invalid indentation may confuse docstring detection
For Developers
Building and Installing
- Install dependencies:
npm install - Compile:
npm run compile - Regenerate the API index (optional):
npm run generate-index - Press F5 to run the extension, or package with
@vscode/vsce
Project Structure
src/- TypeScript source filesdata/doc-index.json- Bundled Ren'Py API indexscripts/- Build scripts for index generation