Decorated functions made into cells keep the function name
bug
### Describe the bug
If I have a function that uses a variable defined in another cell in its body, the function definition (`@app.function`) will be converted into a cell (`@app.cell`). Normally, this will be a cell without a name (`def _(): ...`), but if the original function is decorated, the new cell will inherit the original name of the function.
### Environment
<details>
```
marimo VS Code Extension Diagnostics
=====================================
Language Server (LSP):
UV Bin: Bundled (c:\Users\andrew\.vscode\extensions\marimo-team.vscode-marimo-0.13.3-win32-x64\bundled\libs\bin\uv.exe)
UV: 0.11.3 (45da18ac3 2026-04-01) ✓
Using bundled marimo-lsp via uvx
Python Extension:
Interpreter: c:\Users\andrew\Code\project\code\.venv\Scripts\python.exe
Version: 3.13.9.final.0
Environment: VirtualEnvironment (biaxtic)
Python Language Server (ty):
Status: running ✓
Version: 0.0.26 (940305127 2026-03-26)
Binary: UvInstalled (c:\Users\andrew\AppData\Roaming\Code\User\globalStorage\marimo-team.vscode-marimo\libs\bin\ty.exe)
Python: c:\Users\avg170002\Code\biaxial-bioreactor\code\.venv\Scripts\python.exe (3.13.9.final.0)
Ruff Language Server:
Status: running ✓
Version: 0.15.14
Binary: CompanionExtension/bundled (charliermarsh.ruff, c:\Users\avg170002\.vscode\extensions\charliermarsh.ruff-2026.44.0-win32-x64\bundled\libs\bin\ruff.exe)
Extension Configuration:
Version: 0.13.3
UV integration disabled: false
System Information:
Host: desktop
IDE: Visual Studio Code
IDE version: 1.121.0
Platform: win32
Architecture: x64
Node version: v22.22.1
Common Issues:
1. If notebooks won't open:
- Check Python interpreter is selected
- Ensure marimo is installed
- Check 'marimo-lsp' output channel for errors
2. If features are missing:
- Ensure marimo version is >= 0.23.3
- Try reloading the window
```
</details>
### Steps to reproduce
Starter notebook:
```python
import marimo
__generated_with = "0.23.6"
app = marimo.App()
@app.function
def deco(func):
return func
@app.cell
def _():
x = 2
return
@app.function
@deco
def foo():
return "Hello"
@app.cell
def _():
foo()
return
if __name__ == "__main__":
app.run()
```
Edit `foo()` to include the external variable `x`, and it will become:
```python
@app.cell
def foo(x): # <-- Expected to be `def _(x):`
@deco
def foo():
return "Hello" * x
return (foo,)
```
0 条评论