marimo icon indicating copy to clipboard operation
marimo copied to clipboard

go to declaration does not work within def

Open alefminus opened this issue 9 months ago • 5 comments

Describe the bug

  1. write a def containing a variable assignment and usage.
  2. place cursor on usage, click go to declaration hotkey F12 (or right click menu)
  3. nothing happens

Code to reproduce

def test():
    a = 10
    print(a)

Second variant: if you have a variable in a function body that is also used as a free variable (produced and consumed by cells) than go to definition will jump to it.

Code to reproduce second variant

# line 1
a = 10
# line 2
print(a)

def test():
    # line 3
    a = 10
    # line 4
    print(a)

Select the 'a' below line 4, then press F12, and you will jump to line 1.

Environment

latest git (installed with pip install -e ., and frontend built with make fe)

✦ ❯ python -c 'import marimo; print(marimo.__version__); print(marimo); from os import system; system("cd {}; git describe".format("/home/alon/src/marimo"))'
0.6.0
<module 'marimo' from '/home/alon/src/marimo/marimo/__init__.py'>
0.6.0-17-g502820f1
{
  "marimo": "0.6.0",
  "OS": "Linux",
  "OS Version": "6.8.7-300.fc40.x86_64",
  "Processor": "",
  "Python Version": "3.12.3",
  "Binaries": {
    "Browser": "--",
    "Node": "v20.12.2"
  },
  "Requirements": {
    "click": "8.1.7",
    "importlib-resources": "missing",
    "jedi": "0.19.1",
    "markdown": "3.6",
    "pymdown-extensions": "10.8.1",
    "pygments": "2.18.0",
    "tomlkit": "0.12.5",
    "uvicorn": "0.29.0",
    "starlette": "0.37.2",
    "websocket": "missing",
    "typing-extensions": "4.11.0",
    "black": "24.4.2"
  }
}

alefminus avatar May 21 '24 12:05 alefminus