How to stop pycharm looking for declarations in remote libraries?
已回答
Is there any way to stop indexing Remote libraries? I would like the jump to definition feature to only work on the file project.
Remote libraries are picked up from "/usr/local/lib/python2.7/dist-packages". I couldn't find a way to exclude them.
Remote libraries are under : External libraries -> remote interpereter -> Remote libraries.
I have as well defined scope, but still it looks for declarations in Remote Libraries.
请先登录再写评论。
Hi,
See https://www.jetbrains.com/help/pycharm/configuring-folders-within-a-content-root.html
You can mark those directories as Excluded in Project Structure.
However, this is not gonna make go to declaration work with project files only. It will stop PyCharm from indexing them and code completion will not work for them.
If you would like to have such feature to work with project files only, please feel free to submit a feature request to our issue tracker using the link https://youtrack.jetbrains.com/issues/PY and let us know if you need any help.
Thanks for reply.
I am aware of Excluding directories from project structure. I couldn't do it because I don't see External libraries are under my project structure, in addition, I did not find Exclude option on right click. I am using Pycharm version 2018.2, I will share the screenshot tomorrow.
I see. There is indeed no such possibility. We have filed an issue about that https://youtrack.jetbrains.com/issue/PY-33016, please vote for it and follow for updates.
See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.
Is there a fix for this?
Figured it out.. don't have the root set as your source in Project Interpreter. Set the source to your main project root.
You can also go to Settings > Project Interpreter > little gear thing > Show All... > select your interpreter and click the small button "Show paths for selected interpreters" at the bottom
From there you can remove any paths you don't want indexed, so I removed the remote upload location.
For anyone looking for a solution to "Go to declaration" opening up external libraries files instead of project files the solution is to properly configure your project sources.
Your ctrl clicks will now open up the correct source file. You are welcome, have a nice day :)
Another thing to check is the “scope” you are searching in, e.g. when you use “Go to file…” dialog there is a “scope”, if you set it to “Project Files” it won't search in site packages
EDIT: well, there seems to be a bug or some weird behavior and it will switch from “Project Files” to “All Places” in the middle of typing. Very annoying.