StarlaneStudios / vscode-comment-anchors

⚓A Visual Studio Code extension that adds support for comment anchors 🔭
https://marketplace.visualstudio.com/items?itemName=ExodiusStudios.comment-anchors
MIT License
205 stars 32 forks source link

Linking to jupyter notebook anchors #214

Open peterchenadded opened 9 months ago

peterchenadded commented 9 months ago

Great extension but noticed anchors in jupyter notebooks do not really work.

Steps to reproduce:

  1. Set an anchor in a jupyter notebook
  2. Set a link to that anchor e.g from a python file

Actual:

When clicking on the link it opens the notebook and shows the top of the notebook.

Expected:

Should also scroll to the anchor which could be in any of the markdown/code editors in the notebook and highlight the anchor.

Purpose:

This would be useful because I have not seem any native vscode functionality or extension that can do this and significantly helps with navigation into notebook code.

Did some googling, and I believe adopting below two resources, with comment anchors existing linking to the file working, should allow it to move to the editor that has the anchor.

Loop through notebook cells code https://github.com/xelad0m/vscode-jupyter-toc/blob/main/src/extension.ts

Notebook editor reveal range https://code.visualstudio.com/api/references/vscode-api#NotebookEditor

However, I lack vscode extensions development experience so will take me quite long to implement.