Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Find all References does not search in subdirectories #1988

Closed
PhilipMay opened this issue Jan 28, 2020 · 27 comments · Fixed by #2077
Closed

Find all References does not search in subdirectories #1988

PhilipMay opened this issue Jan 28, 2020 · 27 comments · Fixed by #2077
Assignees
Labels
bug Something isn't working feature: references

Comments

@PhilipMay
Copy link

Environment data

  • VS Code version: Version: 1.41.1
  • Extension version (available under the Extensions sidebar): Version: 1.41.1
  • OS and version: macOS 10.15.2
  • Python version (& distribution if applicable, e.g. Anaconda): conda 3.6

When I use the "Find All References" function it seems only to find references in scripts in the same folder. The extension does not seem to look into subdirectories.

Is this known?

@ericsnowcurrently
Copy link
Member

@PhilipMay, thanks for letting us know about this. Are you using the language server or Jedi (see the "python.jediEnable" setting)? Also, please provide the content of the "Python" output panel and the "Python Language Server" output panel. Thanks!

@PhilipMay
Copy link
Author

Jedi is enabled. I think I can not disable it because Microsoft Python Language Server requires a platform that supports .NET Core 2.1 - and I am on macOS.

@PhilipMay
Copy link
Author

There is no output in the Python panel. And I do not see a "Python Language Server" output panel.

@ericsnowcurrently
Copy link
Member

I think I can not disable it because Microsoft Python Language Server requires a platform that supports .NET Core 2.1 - and I am on macOS.

The Python Language Server supports MacOS.

There is no output in the Python panel.

There should be quite a bit of content there (e.g. commands the extension runs to discover Python environments). Let's make sure we're talking about the same thing. In the "View" menu click on "Output". At the top-right of the "OUTPUT" panel that pops up select "Python" in the pull-down menu.

@PhilipMay
Copy link
Author

@ericsnowcurrently thanks. This here is the output. It only seems to be pylint stuff.

> /usr/local/miniconda3/envs/optuna/bin/python -m pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text ~/develop/git/optuna/optuna/trial.py
cwd: ~/develop/git/optuna
> /usr/local/miniconda3/envs/optuna/bin/python -m pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text ~/develop/git/optuna/optuna/trial.py
cwd: ~/develop/git/optuna
##########Linting Output - pylint##########

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

@ericsnowcurrently
Copy link
Member

Thanks, @PhilipMay. Would you mind trying with the language server? In your settings.json put "python.jediEnabled": false.

@PhilipMay
Copy link
Author

Ok. I turned off jedi.

This is the output of the Python Language Server:

[Info  - 9:07:02 PM] Analysis cache path: /Users/mike/Library/Caches/Microsoft/Python Language Server
[Info  - 9:07:02 PM] Microsoft Python Language Server version 0.5.30.0
[Info  - 9:07:02 PM] Workspace root: /Users/mike/develop/git/optuna
[Info  - 9:07:03 PM] GetCurrentSearchPaths /usr/local/miniconda3/envs/optuna/bin/python 
[Info  - 9:07:03 PM] Interpreter search paths:
[Info  - 9:07:03 PM]     /usr/local/miniconda3/envs/optuna/lib/python3.6
[Info  - 9:07:03 PM]     /usr/local/miniconda3/envs/optuna/lib/python3.6/lib-dynload
[Info  - 9:07:03 PM]     /usr/local/miniconda3/envs/optuna/lib/python3.6/site-packages
[Info  - 9:07:03 PM] User search paths:
[Info  - 9:07:09 PM] Initializing for /usr/local/miniconda3/envs/optuna/bin/python
[Info  - 9:07:09 PM] Analysis caching mode: None.

It still does only find references in scripts in the same folder. The extension does not seem to look into subdirectories.

@ericsnowcurrently
Copy link
Member

@PhilipMay, I'd like to reproduce the problem. What would be the simplest example that would repeat it?

@PhilipMay
Copy link
Author

PhilipMay commented Feb 7, 2020

Great thanks @ericsnowcurrently

  • clone optuna project: https://github.com/optuna/optuna.git
  • open it in vscode with installed python extension
  • open optuna folder
  • open distributions.py script
  • scroll all the way down to the check_distribution_compatibility function
  • right click function
  • Click "Find All References"
  • click "edit" -> "find in files"
  • fill in check_distribution_compatibility
  • start search
  • see that the search finds way more calls to check_distribution_compatibility then the "Find All References" functionality

@ericsnowcurrently
Copy link
Member

@PhilipMay, thanks for the detailed instructions. I was able to reproduce the behavior you've described and agree it shouldn't be happening. We'll work on fixing the problem. Thanks again for letting us know about it.

@ericsnowcurrently ericsnowcurrently removed their assignment Feb 10, 2020
@PhilipMay
Copy link
Author

PhilipMay commented Feb 10, 2020

@ericsnowcurrently Great. Thanks. :-)

@PhilipMay
Copy link
Author

Any news about this? Did you find the reason?

@ericsnowcurrently
Copy link
Member

@PhilipMay, unfortunately we have not had time to work on this and I'm not sure when it might happen. 😞 If you don't see activity on this in the next few weeks please ping me again.

@luabud

1 similar comment
@ericsnowcurrently

This comment has been minimized.

@luabud
Copy link
Member

luabud commented Feb 21, 2020

@jakebailey this seems to be reproducible with the Language Server. Is this a known behaviour?

@jakebailey
Copy link
Member

I know of small issues with references reported on the repo, but I don't have a specific one I'd say this is a duplicate of.

@PhilipMay
Copy link
Author

@ericsnowcurrently @luabud @jakebailey Are you planning to work on a fix for this?

For me this is realy an hard issue because it makes it difficult to understand code from other ppl. For me it is a reason to switch to some other IDE although I like VSCode very much.

I would try to fix it myself but I am not confident with this.

@PhilipMay
Copy link
Author

@ericsnowcurrently @luabud @jakebailey Are there any news on this?

@luabud luabud transferred this issue from microsoft/vscode-python Apr 7, 2020
@jakebailey jakebailey added bug Something isn't working feature: references labels Apr 7, 2020
@MikhailArkhipov
Copy link

Looks like #1686 broke it. Before

image

With the loop handling when I modify a file AND the file is a loop, then analysis runs on more than one file and it looks that sometimes AddReference does not go to the right place.

@jakebailey
Copy link
Member

What's interesting is that presumably jedi/rope didn't handle this either, so this seems pretty exceptional.

@PhilipMay
Copy link
Author

@AlexanderSher could you please have a look into this issue? @MikhailArkhipov sais it might be connected to a PR you have been involved. See here: #1686

@jakebailey
Copy link
Member

Alex is no longer working on this codebase. There's no reason to specifically ping people, we can handle that ourselves.

@PhilipMay
Copy link
Author

Alex is no longer working on this codebase. There's no reason to specifically ping people, we can handle that ourselves.

Great. I am sorry. Did not intend to interfere with your team processes.

@PhilipMay
Copy link
Author

Hi, any updates or progress on this topic?
Thanks
Philip

@MikhailArkhipov
Copy link

0.5.51 in daily channel

@PhilipMay
Copy link
Author

PhilipMay commented Jun 19, 2020

So this is fixed - right?

How to I install this fixed version with VSCode?
When will it be released officially?

@MikhailArkhipov
Copy link

LS is updated independently from VS Code. It is already out in daily channel. If all good, we promote to beta and then to stable. Set

"python.analysis.downloadChannel": "daily"

then restart. You should get 0.5.51.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working feature: references
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants