Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement: click hourglass to move view to current cell #1040

Merged

Conversation

fuenfundachtzig
Copy link
Contributor

Addresses #1030

Copy link

vercel bot commented Mar 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 1, 2024 8:21pm
marimo-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 1, 2024 8:21pm

const { cellIds } = store.get(notebookAtom);
const cellIdx = Object.values(state.cellRuntime).findIndex(
(cell) => cell.status === "running",
);
Copy link
Contributor

Choose a reason for hiding this comment

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

i think you can avoid wiring the state through, and might be able to change this to:

  const { cellRuntime } = store.get(notebookAtom);
  const cell = Objects.entries(cellRuntime).find(
    ([cellId, runtime]) => runtime.status === "running",
  )
  if (!cell) {
     return;
  }
  const view = getCellEditorView(cell[0]);
  view?.dispatch({
    selection: { anchor: 0 },
    effects: [EditorView.scrollIntoView(0, { y: "center" })],
  });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks good, thanks for the suggestion :) I'll give it a try.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the PR to your suggestion. Thanks for the improvement :)

Copy link
Contributor

@mscolnick mscolnick left a comment

Choose a reason for hiding this comment

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

nice stuff!

@mscolnick mscolnick changed the title click hourglass to move view to current cell improvement: click hourglass to move view to current cell Apr 1, 2024
@mscolnick mscolnick merged commit ac33436 into marimo-team:main Apr 1, 2024
26 checks passed
Copy link

github-actions bot commented Apr 1, 2024

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

@fuenfundachtzig fuenfundachtzig deleted the feature/jump-to-running-cell branch April 2, 2024 16:48
Benni-Math pushed a commit to Benni-Math/marimo that referenced this pull request Apr 16, 2024
…m#1040)

* click hourglass to move view to current cell

* removed dependence on NotebookState as per review comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants