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

New Feature: Run Cells Above #48

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ESSO0428
Copy link

@ESSO0428 ESSO0428 commented May 24, 2024

New Feature: Run Cells Above (Revert README.md to raw Repo content)

This pull request introduces a new feature run_cells_above to the NotebookNavigator plugin. This function allows users to execute all code cells above the current cell, which is similar to functionality seen in tools like Jupyter notebooks.

Implementation:

  • The function calculates the current cell's position and executes each cell above it.
  • Utilizes the existing infrastructure for running cells but adds logic to determine the scope of execution dynamically based on the cursor's position.

Usage:

Users can invoke this function via a command or keybinding in Neovim. Example usage might be via a mapped key in normal mode, such as below

   ...
    keys = {
      ...
      { "[e", function() require("notebook-navigator").run_cells_above "" end },
    },
   ...

Request for Feedback:

Please review the implementation details and functionality. I am open to suggestions for improvements or additional scenarios that should be considered.

Looking forward to your feedback and hoping for integration into the main project!


Thanks to @IndianBoy42 for pointing this out! This update introduces the new 'Run Cells Above' feature and reverts the changes in README.md to its original content. The changes to the repository name in README.md have been reverted.

@ESSO0428 ESSO0428 changed the title New Feature: Run Cells Above New Feature: Run Cells Above (Revert README.md to raw Repo content) May 26, 2024
@ESSO0428 ESSO0428 changed the title New Feature: Run Cells Above (Revert README.md to raw Repo content) New Feature: Run Cells Above May 26, 2024
@dlyongemallo
Copy link

I was looking for exactly this function.

I have a minor suggestion, though: I think the function name should make clear that it excludes the current cell. (Actually, I guess it's run_cells_below which is slightly misleading, as it includes the current cell, but at this point it would be breaking backwards compatibility to rename it.)

@ESSO0428
Copy link
Author

I was looking for exactly this function.

I have a minor suggestion, though: I think the function name should make clear that it excludes the current cell. (Actually, I guess it's run_cells_below which is slightly misleading, as it includes the current cell, but at this point it would be breaking backwards compatibility to rename it.)

Thanks for the suggestion! Perhaps we can simplify and mimic VSCode by naming the functions run_above and run_below. This way, the names are more intuitive and easier to understand.

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.

2 participants