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

"Find All References" does not show results in notebook files unless the notebook is explicitly opened #6022

Closed
epicwhale opened this issue Mar 28, 2024 · 1 comment
Assignees
Labels
duplicate This issue or pull request already exists

Comments

@epicwhale
Copy link

In a normal .py file when I right click a function declaration to use the "Find All References" feature, I expect it to show me all references across the entire project/workspace. But what I noticed is it that the results exclude my notebooks (.ipynb files). But if I my notebook is open in a tab, then it shows it as a result. Is this working as intended?

Environment data

  • VS Code version: Version: 1.88.0-insider
  • Jupyter Extension version (available under the Extensions sidebar): v2024.3.2024032701 (pre-release)
  • Python Extension version (available under the Extensions sidebar): v2024.3.10871011 (pre-release)
  • OS (Windows | Mac | Linux distro) and version: Mac
  • Python and/or Anaconda version: 3.12
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Jupyter server running: Local

Expected behaviour

Show references across all files in project, including notebook files

Actual behaviour

Always excludes notebook files unless open.

Steps to reproduce:

  1. "Find all references" for a function (WITHOUT any notebook files are open in tabs)
image

1 result in 1 file
image

  1. Now, if I open a notebook using that same function, and run the same Find all references, as you can see here, it shows 2 results.
image
@epicwhale epicwhale added the bug Something isn't working label Mar 28, 2024
@rebornix rebornix transferred this issue from microsoft/vscode-jupyter Jun 13, 2024
@rebornix rebornix removed their assignment Jun 13, 2024
@karthiknadig karthiknadig removed the bug Something isn't working label Jun 17, 2024
@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Jun 17, 2024
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Jun 17, 2024
@rchiodo
Copy link
Contributor

rchiodo commented Jun 17, 2024

Thanks for the issue. This is known limitation and is discussed more in this item here:
#5175

The root cause is we can't guess what the URI of a notebook cell is going to be as VS code generates that ID at runtime. So although we could look on disk for notebook references, we can't generate the correct URI so that when VS code opens the notebook it matches what we found.

The current thinking is we have to open all of the notebooks in memory inside of VS code in order to return references to them, but we haven't tried that tactic yet.

@rchiodo rchiodo added duplicate This issue or pull request already exists and removed needs repro Issue has not been reproduced yet labels Jun 17, 2024
@rchiodo rchiodo closed this as completed Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

5 participants