alefragnani / vscode-bookmarks

Bookmarks Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks
GNU General Public License v3.0
1.68k stars 163 forks source link

[FEATURE] - Add Jupyter Notebook support #531

Open TiesdeKok opened 2 years ago

TiesdeKok commented 2 years ago

This is a duplicate of two existing issues, (#456 and #294) however, a lot has changed in the VSCode Jupyter Notebook landscape since these previous issues, so I decided to make a new one.

Feature request

Allow the bookmark function to work in the "new" VSCode Jupyter notebook interface. I use bookmarks all the time and it would fantastic to be able to also use them in the VSCode interface.

Current state

Bookmarks actually do show up currently, however, they apply to all cells at the same time. My guess is this is due to the way that line numbers work, they are created at the cell level, not the document level in a notebook. So setting a bookmark at line 3 in one cell will set a bookmark in all cells at line 3:

image

Thanks for the hard work and amazing extension!

alefragnani commented 2 years ago

Hi @TiesdeKok ,

First of all, thank you for you kind words. I’m glad you like the extension.

About the issues, yes, this is a duplicate of #294. But I’ll keep your issue opened because it has a few more details.

Hope this helps

javicarron commented 1 year ago

Thank you for the great extension, I was wondering if there is any update for notebook support.

I do not know if it helps, but the functionality can be (kind of) recreated with breakpoints. By toggling breakpoints and navigating to next/previous breakpoint. This does not cycle and does not go to other documents, but perhaps it is useful to see how that is handled internally. And sorry if this does not help, I have never explored how vscode extensions actually work internally.

Jnorm911 commented 1 year ago

Bump. Notebooks are becoming more popular, I'm sure this request will continually get more popular.

frankfletcher commented 11 months ago

Hopeful bump.

Current status:

umair-hassan commented 10 months ago

request to incorporate this please

xtzorig commented 10 months ago

Is there prerelease or something else like custom settings for this issue?

Malibu351 commented 9 months ago

The problems I have encountered are different from the current situation, but I have placed them in this place so that more people can see them. The bookmark of the current cell will disappear when the cell is running and the cursor is moved to another cell, as follows: 284455078-ceae0e97-1f8f-4903-ac1b-51c283b2df69

I guess bookmarks themselves are recorded in cell text in notebooks. If you want to solve this problem, you may need to consider the inheritance method of bookmarks between different cells. (The above content comes from translation)

alefragnani commented 9 months ago

@Malibu351 bookmarks uses a regular text file approach, just like everything is a .txt. If the file has 10 lines, you can have 10 bookmarks (one for each file).

Notebooks, on the other hand, are not regular text files. They have regions to determine the cells and other attributes, they can be written in JSON or TXT files, at least. So, a Notebook with 3 visible lines are in fact a text file with around 30 lines, as shown in the Jupiter Notebook print below:

image

So, in order to make the Bookmarks extension to support Notebooks, it must handle those structures. As you can see, there are two different formats here, .ipynb provided by Jupiter Notebook extension and .dib from the Polyglot Notebook extension. I don't use Notebooks that much so I don't know how many formats exists, but I'll start looking at these two.

umair-hassan commented 9 months ago

for me the problem is mainly that it does not open the ipnyb in vscode but a string-ed version of it.

alefragnani commented 9 months ago

@umair-hassan this too. It happens because it uses the APIs to open/view regular files, and I just noticed that Notebooks have their one API.

umair-hassan commented 9 months ago

so how do i fix?

alefragnani commented 9 months ago

Unfortunately, there is nothing you can do / setting to change, to fix it.

I need to update the extension, either blocking bookmarks from being toggled in Notebooks, or supporting Notebooks.

schneipk commented 3 months ago

I'd love to see it work. Is there no way for the extension to check what file it is jumping to and decide which API to call and editor to open? I love the work, I'm just working in too many Jupyter Notebooks lately :D Thank you @alefragnani !

ibobak commented 2 months ago

Will this feature be done at some point of time?