Skip to content

ty LSP doc is not highlighted and is duplicated #9718

@benruijl

Description

@benruijl

Describe the bug

My package Symbolica comes from a Rust-generated wheel and therefore has all its type information in a .pyi file. The default LSP does not support this (leading to no docs at all for the expand method in the image below), and therefore I switched the LSP to ty.

With ty, and before executing the cell, I get a good description of the function but there is no syntax highlighting:

Image

After executing the cell, the docs that are embedded inside the .so file are now displayed on top of the ty hint:

Image Image

The newly added documentation block does have highlighting, but renders worse (see the parameter list). Ideally, this block should not be added at all, and the ty docs should have highlighting.

Will you submit a PR?

  • Yes

Environment

{
  "marimo": "0.23.8",
  "editable": false,
  "location": "/usr/lib/python3.14/site-packages/marimo",
  "OS": "Linux",
  "OS Version": "7.0.10-arch1-1",
  "Processor": "",
  "Python Version": "3.14.5",
  "Locale": "--",
  "Binaries": {
    "Browser": "--",
    "Node": "v26.2.0",
    "uv": "0.11.16 (135a36367 2026-05-21 x86_64-unknown-linux-gnu)"
  },
  "Dependencies": {
    "click": "8.3.3",
    "docutils": "0.22.4",
    "itsdangerous": "2.2.0",
    "jedi": "0.19.2",
    "markdown": "3.10.2",
    "narwhals": "2.21.2",
    "packaging": "26.2",
    "psutil": "7.2.2",
    "pygments": "2.20.0",
    "pymdown-extensions": "10.21.2",
    "pyyaml": "6.0.3",
    "starlette": "1.1.0",
    "tomlkit": "0.15.0",
    "typing-extensions": "4.15.0",
    "uvicorn": "0.38.0",
    "websockets": "16.0"
  },
  "Optional Dependencies": {
    "loro": "1.10.3",
    "nbformat": "5.10.4",
    "pandas": "2.3.3",
    "pyarrow": "24.0.0",
    "pytest": "9.0.3",
    "python-lsp-ruff": "2.3.1",
    "python-lsp-server": "1.14.0",
    "ruff": "0.15.15",
    "ty": "0.0.39",
    "watchdog": "6.0.0"
  },
  "Experimental Flags": {}
}

Code to reproduce

# /// script
# requires-python = ">=3.12"
# dependencies = [
#     "marimo>=0.23.8",
#     "symbolica>=1.5.0",
# ]
# ///
import marimo

__generated_with = "0.23.8"
app = marimo.App(width="medium")


@app.cell
def _():
    from symbolica import S, E, Expression, Graph, HalfEdge
    import marimo as mo

    return E, Graph, HalfEdge, S


@app.cell
def _(E):
    e = E('(1+x)^100').expand()
    e
    return (e,)

if __name__ == "__main__":
    app.run()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions