This file does not belong to the project...?

I know I must have read about this somewhere but...when I'm in break-mode and I see where I want to edit the code , maybe in a different file to the one with the break in, I get the "This file does not belong" message. In the PHPStorm header it shows the path as the origin of the symlink, but so are all the files I work on and i don't get the complaint about them.

If i do edit the file the editor has an issue between the file I've edited (I guess its holding in memory) and the on one on disk...?

To work on the correct file I have to go to the project explorer and select the file again thru that, which is a pain...what am I don't wrong? 

0
15 comments

Could you please attach screenshots of your directory structure and the IDE window including the path when you get the error?
It's hard to understand how you open a file that can't be edited properly. Thanks!

0

Hi, sorry delay for posting but here are two pic's showing the same file, the first one after just having stopped the debugger, note the file path in the IDE header:

and then after clicking on the file in the Project Explorer - not much to show but the IDE header/file path:

The second one without the problem is showing the relative path in the IDE header.

I would add that I'm having the same behaviour with Linux as I was with Windows.

0

Thanks for sharing the screenshot.

As far as I see fro a window title, the file is located in /vendor/ directory, right?

Could you please check if this directory is marked as excluded in "Settings > Directories"?

1

Yes, but the problem is , its a vendor folder nowhere near the project folder, its been symlinked in. Should i add it anyway? 

It seems that sometimes phpstorm chooses to use the symlinked destination path (in the project folder) and its ok, but other times it uses the 'real path' and then doesn't like it.

0

Maybe it's worth adding debugging mappings? When PhpStorm gets a debugging connection, the Xdebug sends original paths to it, and PhpStorm just doesn't understand how the original files correspond to the symlinked project files.

Please describe that at Settings | Languages & Frameworks | PHP | Servers.

0

I get the same sort of error in PyCharm 2020.1 EAP (Professional Edition)

I have ~/PycharmProjects symlinked to /opt/code/PycharmProjects 

When I get a Traceback (stacktrace) it shows the file paths under /opt/code.  When I click on the filename to see the problem spot, I often get the dialog box for "non-Project Files Protection" saying "this file does not belong to the project".  The popup does not occur until I try to actually edit the file in question.

The files are part of the project and are included in the git files handling.

Thanks

PyCharm 2020.1 EAP (Professional Edition)
Build #PY-201.5259.14, built on February 12, 2020
PyCharm EAP User
Expiration date: March 13, 2020
Runtime version: 11.0.6+8-b722.2 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 3.10.0-1062.12.1.el7.x86_64
GC: ParNew, ConcurrentMarkSweep
Memory: 1970M
Cores: 4
Registry: ide.suppress.double.click.handler=true
Non-Bundled Plugins:

0

Correct me if I am wrong but isn't the IDE right that files are out of the project if these are located under "/opt/code/" whereas the project is located at "/opt/code/PycharmProjects" or I misunderstood your scenario?

0

Depends a bit on how you look at it. 

 - All the project code is under "/opt/code/PycharmProjects", due to it being soft linked to my home.

 - PyCharm is the one that followed the symlink to the actual location and then displayed the file when I clicked on the Traceback.

0

Bob Jones, if I get it right, this is the issue you are having: https://youtrack.jetbrains.com/issue/PY-31170
And it's claimed to be fixed in 2019.3. If it's not working properly in 2020.1, just as you say, probably it makes sense to submit another bug report to the PyCharm tracker: https://youtrack.jetbrains.com/newIssue?project=PY

0

I have had the same problem with WebStorm 2020.2 on Windows without any symlinks or smth. IDE was just broken one day - no search for classes, no real navigating, no autocompletion.

Deleting the ".idea" directory helped.

Actually I have done the "git clean -fdx", so the ".idea" and "node_modules" was removed and then it start working again. 

 

 

1

On linux you can always do 'readlink -f FILENAME' to get the true path of any file with all symlinks resolved. In this way, it should be possible for the IDE to recognize that files belong to the project, regardless of the path through which they are accessed. 

 

0

I have a similar issue that is unrelated to symbolic links. I am using a remote python interpreter in a console and when there is an error, I get a clickable link showing the remote file path which differs from the local path. Clicking on the link opens the file, but when trying to edit the file I get the popup 'This file does not belong to the project'. 

 

0

Hey Guys, I was able to clear the "This File does not belong to the Project issue" by accessing the setting on PyCharm in the File tab. From there, I clicked on my Project and went to the Project structure only to find that my "venv" file was marked as excluded (for some odd reason). I clicked on venv to list it as a source (because this is the file where my script lives) and it cleared my problem right up. I hope this helps somebody out there!

1

Is it fair to say working in a project that's located through a symlink is prone to this, and hence it's better not to?

0

Is it fair to say working in a project that's located through a symlink is prone to this, and hence it's better not to?

There are different issues related (and unrelated) to symlinks in this thread. For example, the one in PyCharm is fixed already (PY-31170). Could you please tell a bit more about your concern?

0

Please sign in to leave a comment.