Skip to content

Inconsistent autocompletion #5549

@shoaibkhanz

Description

@shoaibkhanz

Describe the bug

I’ve encountered two related issues with autocompletion in Marimo notebooks:

1. Cross-cell Autocompletion Doesn’t Pick Up Previous Definitions:
When I define a variable or function (e.g., optimizer22) in one cell, and then try to use it in a different cell (e.g., typing optim), the autocompletion does not suggest optimizer22. This breaks the expectation of notebook-style workflows where previously defined variables should be accessible across cells for completion.

2. Autocompletion Stops Working Mid-Session
Occasionally, during normal use, autocompletion stops functioning entirely, even though the kernel remains responsive and code execution still works. To resolve this, I need to manually restart the kernel, which disrupts workflow.

Image Image

Environment

Here is my pyproject.toml and marimo.toml and I have installed lsp using brew install python-lsp-server

[project]
name = "deeplearning"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
  "ipython>=8.27.0",
  "jupyterlab>=4.2.5",
  "marimo[lsp]>=0.14.10",
  "matplotlib>=3.9.2",
  "numpy>=2.1.1",
  "openai>=1.93.0",
  "pandas>=2.2.3",
  "polars>=1.8.2",
  "seaborn>=0.13.2",
  "torch>=2.4.1",
]

[tool.marimo.experimental]
lsp = true

# Language server configuration
[tool.marimo.language_servers.pylsp]
enabled = true            # Enable/disable the Python language server
enable_mypy = false       # Type checking with mypy (enabled by default, if installed)
enable_ruff = true        # Linting with ruff (enabled by default, if installed)
enable_flake8 = false     # Linting with flake8
enable_pydocstyle = false # Check docstring style
enable_pylint = false     # Linting with pylint
enable_pyflakes = false   # Syntax checking with pyflakes

# Diagnostics configuration
[tool.marimo.diagnostics]
enabled = true # Show diagnostics in the editor

marimo.toml

[ai]
rules = ""
mode = "manual"

[ai.google]

[ai.open_ai]
model = "gpt-4.1"
api_key = "sk-proj-tDg_******"

[ai.anthropic]

[ai.bedrock]

[display]
dataframes = "rich"
cell_output = "below"
theme = "system"
reference_highlighting = false
default_width = "full"
code_editor_font_size = 16
default_table_page_size = 15

[server]
browser = "default"
follow_symlink = false

[save]
autosave_delay = 1000
format_on_save = false
autosave = "after_delay"

[package_management]
manager = "uv"

[formatting]
line_length = 79

[runtime]
std_stream_max_bytes = 1000000
default_sql_output = "auto"
auto_reload = "off"
output_max_bytes = 8000000
auto_instantiate = true
on_cell_change = "autorun"
reactive_tests = true
watcher_on_save = "lazy"

[keymap]
vimrc = "/Users/shoaib/git-projects/configs/.vimrc"
preset = "vim"

[keymap.overrides]

[snippets]
custom_paths = []
include_default_snippets = true

[language_servers.pylsp]
enable_pyflakes = false
enabled = true
enable_pylint = false
enable_pydocstyle = false
enable_mypy = true
enable_ruff = true
enable_flake8 = false

[diagnostics]

[experimental]

[completion]
copilot = false
activate_on_typing = true

marimo env

{
  "marimo": "0.14.10",
  "OS": "Darwin",
  "OS Version": "24.5.0",
  "Processor": "arm",
  "Python Version": "3.12.7",
  "Binaries": {
    "Browser": "138.0.7204.93",
    "Node": "v24.3.0"
  },
  "Dependencies": {
    "click": "8.2.1",
    "docutils": "0.21.2",
    "itsdangerous": "2.2.0",
    "jedi": "0.19.2",
    "markdown": "3.8.2",
    "narwhals": "1.45.0",
    "packaging": "25.0",
    "psutil": "7.0.0",
    "pygments": "2.19.2",
    "pymdown-extensions": "10.16",
    "pyyaml": "6.0.2",
    "starlette": "0.47.1",
    "tomlkit": "0.13.3",
    "typing-extensions": "4.14.1",
    "uvicorn": "0.35.0",
    "websockets": "15.0.1"
  },
  "Optional Dependencies": {
    "nbformat": "5.10.4",
    "openai": "1.93.0",
    "pandas": "2.3.0",
    "polars": "1.31.0",
    "loro": "1.5.2",
    "python-lsp-ruff": "2.2.2",
    "python-lsp-server": "1.12.2",
    "ruff": "0.12.2"
  },
  "Experimental Flags": {
    "lsp": true
  }
}

Code to reproduce

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions