Cannot find declaration to go to (solved)
已回答
File -> settings -> Project Interpreter -> show all > + system interpreter
File -> settings -> Project structure -> cancel all checked and set only root as a source
File -> invalidate caches
must ok
by Jesse Stone
请先登录再写评论。
It didn't work for me
Avinash15 Kumar Please file a bug at https://youtrack.jetbrains.com/newIssue?project=IDEA with the issue details.
Same for me: not working whereas everything was fine (without any parameter update by the way) in previous versions of PyCharm
@Raphael Minato does it help if you invalidate caches? (File | Invalidate chache..)? If not, please file a bug at https://youtrack.jetbrains.com/newIssue?project=IDEA with the issue details.
Thanks but no, none of the tips advised here https://intellij-support.jetbrains.com/hc/en-us/community/posts/360005050480-Cannot-find-declaration-to-go-to-solved- worked out.
A bug has already been filed there https://youtrack.jetbrains.com/issue/IDEA-281140
I also see the message "Cannot find declaration to go to" and all suggested solutions do not work.
Maxim Yushin Please contact support at https://intellij-support.jetbrains.com/hc/requests/new with the sample to reproduce and the logs (Help | Collect Logs and Diagnostic Data).
In my case the problem was the next: for some reasons *.py files were registered as a text files, not python ones. After I changed it, code completion started to work again.
To change file type go Preferences -> Editor -> File types
It's a common problem, see https://stackoverflow.com/a/13374653/104891.
Working in Unity/C#.
Did an update this morning to 2022.3.3, once upgraded & restarted, PC too, I got a pop up about invalidate caches, my typically colorful code was very blah looking, nothing was highlighting correctly, so I took the suggestion and restarted.
Opened Rider again and same, I could not F12, jump to my methods, Rider was saying "could not find declaration".
I looked that up and and got here.
Followed the File -> invalidate caches and that didn't work.
Eventually, what worked for me, and not sure this is completely logically, but did work so this is why I'm posting: I usually have 6-12 code windows opened, so I closed each one, then closed Rider, relaunched Rider from within Unity and finally saw all my code highlighted in the correct way and was able to start working again! [Definitely a bit freaked out!!]
Hey, I'm working with RubyMine under Windows 11's WSL2 (Ubuntu 22.04) and I'm using rbenv as a ruby version manager. I also had the problem with cannot find declaration to go to which I resolved by adding Ruby version as an wsl2 interpreter and synchronize gems and RubyMine helper files - Settings > Language and Frameworks > Ruby SDK and Gems, then add rbenv's Ruby e.g. \\wsl$\Ubuntu-22.04/home/<User>/.rbenv/versions/3.1.3/bin/ruby and after that hit ctrl+r or the red download arrow next to the list. Hopefully it will be of some use for future same-problem-having users :)
In my case the “.php” file extension was associated with the text content type. Adding “*.php” to “file name patterns” under “Settings → File Types → PHP” has fixed it for me.