Skip to content

fix: dismiss Jedi signature hint on Escape and closing paren - #10162

Merged
Light2Dark merged 6 commits into
mainfrom
fix/signature-hint-dismiss
Jul 17, 2026
Merged

Light2Dark merged 6 commits into
mainfrom
fix/signature-hint-dismiss

Conversation

@Light2Dark

@Light2Dark Light2Dark commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

📝 Summary

The non-LSP (Jedi) signature hint introduced in #10045 lives in its own CodeMirror field (signatureHintField) that was never wired into any dismissal path. As a result, pressing Escape did not close the docstring/signature tooltip, and it also lingered after the call was closed. The LSP signature-help path already handles all of this; only the Jedi fallback path regressed.

  • Route the hint through the existing closeSignatureHelp, so Escape / blur / run-cell dismiss it consistently with the LSP signature help. handleEscape now treats an active hint like LSP signature help (dismiss + stay in edit mode), avoiding a fall-through to command mode.
  • Dismiss the hint once the cursor leaves the call (e.g. the closing ) is typed) via a bounded parentheses-balance scan mirroring the LSP path's isCursorInsideFunctionCall. No new keymap is added, so there is no interaction with Vim's Escape handling or double-handling with handleEscape.

The scan only runs while a hint is actually visible and the doc changes, and is capped to 20 lines back — so normal typing is unaffected.

Screen.Recording.2026-07-14.at.12.19.17.AM.mov

📋 Pre-Review Checklist

  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • Video or media evidence is provided for any visual changes (optional).

✅ Merge Checklist

  • I have read the contributor guidelines.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Tests have been added for the changes made.

Made with Cursor

The non-LSP (Jedi) signature hint added in #10045 lived in its own
field with no dismissal wiring, so Escape (and typing the closing
paren) left it stuck on screen.

- Route the hint through the existing `closeSignatureHelp` path, so
  Escape/blur/run-cell dismiss it like the LSP signature help.
- Dismiss the hint once the cursor leaves the call, using a bounded
  parentheses-balance scan mirroring the LSP behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Light2Dark Light2Dark added the bug Something isn't working label Jul 13, 2026
@vercel

vercel Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jul 14, 2026 9:22am

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes dismissal behavior for the non‑LSP (Jedi) signature hint tooltip so it closes consistently (Escape / blur / run-cell) and auto-dismisses when the cursor leaves the call (e.g., typing the closing )), aligning it with the existing LSP signature-help UX.

Changes:

  • Add a bounded backward paren-balance heuristic to dismiss the Jedi signature hint once the call is closed.
  • Route Jedi hint dismissal through the existing closeSignatureHelp pathway (Escape handling and other close paths).
  • Add/extend unit tests covering dismissal on ) and Escape-driven dismissal behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
frontend/src/core/codemirror/completion/signature-hint.ts Adds isCursorInsideCall heuristic and a closeSignatureHint helper to dismiss the Jedi tooltip.
frontend/src/core/codemirror/completion/tests/signature-hint.test.ts Adds test coverage for call-close dismissal and explicit close helper behavior.
frontend/src/components/editor/navigation/navigation.ts Treats the Jedi hint as “signature help” for Escape handling and ensures closeSignatureHelp also closes the hint.
frontend/src/components/editor/navigation/tests/navigation.test.ts Adds a regression test ensuring Escape dismisses the Jedi hint without exiting edit mode.

@Light2Dark
Light2Dark marked this pull request as ready for review July 13, 2026 16:19
@Light2Dark
Light2Dark requested a review from akshayka July 13, 2026 16:19

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files

Architecture diagram
sequenceDiagram
    participant User as User (Keyboard)
    participant EditorView as EditorView (CodeMirror)
    participant Nav as Navigation (useCellEditorNavigationProps)
    participant CloseHelp as closeSignatureHelp()
    participant SigHintField as signatureHintField (StateField)
    participant CursorCheck as isCursorInsideCall()

    Note over User,CursorCheck: Escape Key Press (Jedi hint active)

    User->>EditorView: press Escape
    EditorView->>Nav: onKeyDown(event)
    Nav->>Nav: Check hasSignatureHelp
    alt hasSignatureHelp (NEW: includes signatureHintField)
        Nav->>CloseHelp: closeSignatureHelp(view)
        Note over CloseHelp: Also dismisses LSP tooltip (unchanged)
        CloseHelp->>SigHintField: NEW: closeSignatureHint(view)
        SigHintField->>SigHintField: dispatch setSignatureHintEffect(null)
        SigHintField-->>CloseHelp: true (hint dismissed)
        CloseHelp-->>Nav: return
        Nav->>EditorView: dispatch (clear hint)
        Note over Nav,EditorView: Stay in edit mode (no focusCell)
    else hasSignatureHelp is false
        Nav->>EditorView: handle escape as command mode (unchanged)
    end

    Note over User,CursorCheck: Typing Closing Parenthesis (cursor leaves call)

    User->>EditorView: type ")"
    EditorView->>SigHintField: transaction (docChanged + selection)
    SigHintField->>CursorCheck: NEW: isCursorInsideCall(state, head)
    Note over CursorCheck: Scans back ≤20 lines counting parens
    alt balance > 0 (still inside call)
        CursorCheck-->>SigHintField: true
        SigHintField->>SigHintField: map pos, keep hint
    else balance ≤ 0 (outside call)
        CursorCheck-->>SigHintField: false
        SigHintField->>SigHintField: return null (dismiss hint)
    end
Loading

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread frontend/src/core/codemirror/completion/signature-hint.ts Outdated
Comment thread frontend/src/core/codemirror/completion/signature-hint.ts Outdated
Comment thread frontend/src/core/codemirror/completion/signature-hint.ts Outdated
Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread frontend/src/core/codemirror/completion/signature-hint.ts Outdated
Scan from the hint's anchor (just inside the call's paren) to the cursor
instead of a global backward scan, so grouping parens around a call
(e.g. `(plt.plot())`) no longer keep a stale hint alive after the call
is closed. Also removes the 20-line bound. Adds regression tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread frontend/src/core/codemirror/completion/signature-hint.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread frontend/src/core/codemirror/completion/signature-hint.ts Outdated
@Light2Dark
Light2Dark merged commit 8c60aef into main Jul 17, 2026
31 checks passed
@Light2Dark
Light2Dark deleted the fix/signature-hint-dismiss branch July 17, 2026 15:08
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.15-dev30

williambdean pushed a commit to williambdean/marimo that referenced this pull request Sep 6, 2026
…team#10162)

## 📝 Summary

The non-LSP (Jedi) signature hint introduced in marimo-team#10045 lives in its own
CodeMirror field (`signatureHintField`) that was never wired into any
dismissal path. As a result, pressing `Escape` did not close the
docstring/signature tooltip, and it also lingered after the call was
closed. The LSP signature-help path already handles all of this; only
the Jedi fallback path regressed.

- Route the hint through the existing `closeSignatureHelp`, so **Escape
/ blur / run-cell** dismiss it consistently with the LSP signature help.
`handleEscape` now treats an active hint like LSP signature help
(dismiss + stay in edit mode), avoiding a fall-through to command mode.
- Dismiss the hint once the cursor **leaves the call** (e.g. the closing
`)` is typed) via a bounded parentheses-balance scan mirroring the LSP
path's `isCursorInsideFunctionCall`. No new keymap is added, so there is
no interaction with Vim's `Escape` handling or double-handling with
`handleEscape`.

The scan only runs while a hint is actually visible and the doc changes,
and is capped to 20 lines back — so normal typing is unaffected.


https://github.com/user-attachments/assets/53838ef7-f123-4a81-9e57-51ef03b83c5c

## 📋 Pre-Review Checklist

- [x] For large changes, or changes that affect the public API: this
change was discussed or approved through an issue, on
[Discord](https://marimo.io/discord?ref=pr), or the community
[discussions](https://github.com/marimo-team/marimo/discussions) (Please
provide a link if applicable). <!-- small bug fix -->
- [x] Any AI generated code has been reviewed line-by-line by the human
PR author, who stands by it.
- [x] Video or media evidence is provided for any visual changes
(optional).

## ✅ Merge Checklist

- [x] I have read the [contributor
guidelines](https://github.com/marimo-team/marimo/blob/main/CONTRIBUTING.md).
- [x] Documentation has been updated where applicable, including
docstrings for API changes.
- [x] Tests have been added for the changes made.

Made with [Cursor](https://cursor.com)

---------

Co-authored-by: Cursor <cursoragent@cursor.com>

This branch was successfully deployed

1 active deployment
Preview — b9fc871a Deployed Jul 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants