-
-
Notifications
You must be signed in to change notification settings - Fork 884
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
Follow symlink when resolving canonical path #4100
Conversation
The whole point of coping f-canonical from |
I changed the code to only call The suggested manual add of project folders for every single project that happens to be in a symlinked directory feels wrong for user experience. There is probably a semantic discussion about if symbolic links should be treated as separate files or not, so that all packages would treat them accordingly. For now ivy and others do not try to resolve but projectile does (projects added are always resolved following symlinks). Because projectile seems to only add symlink-folllowed path (automatically, maybe this happens somewhere before), I think that when matching a file to already known project we should resolve symbolic links. |
We should either not resolve anywhere or resolve everywhere. If we resolve like you are suggesting it will break the opposite case when the user is not following the symlinks for the files but the root symlinks are followed. |
I don't see the opposite way of breaking : I understand following symlinks could break other things but now it seems that every lsp-mode user will have problems if/when having any symlink to their projects. |
You have the following layout:
If I go into bar and open projectFIle the filename will be bar/projectFile. If you do the same from bar-symlink then I will get file bar-symlink/projectFile. Based on whether I do file-truename for the file will get only one of these working, right? If you make one of them work you will break the other. Furthermore, if I open projectFile under the symlink I will be asked to import the symlink dir as project root. If I do the same from the real path I will be asked to import the real path. lsp-mode cannot make both working without resolving to using file-truename |
This is exactly the opposite, I can open from |
The root of the project is not automatically selected but it is selected/confirmed by you. On my side it recommends the symlink version and it most likely depend on settings like vc-follow-symlinks and related. As you can see going one way or another cannot handle both cases and it will me up to the user to pick appropriate project root based their custom configuratoin. |
I'd love to know other people feedback on this. I'll let this PR open for a while and will close it if no discussion appears on this issue. Feel free to close it if you think this will never happen anyway. I will try to dig more on the possibilities to setup emacs environment to avoid the problem I faced. |
I am closing this PR, this may not even be relevant any more. |
I created an issue in the spacemacs project (syl20bnr/spacemacs#16070) because the root-project was not find every time I was opening files from my projects.
It turns out that if projects are from a symlinked folder the lsp-session always saves the canonical path following the symlinks but during the matching when opening a file the symlink are not followed.
Adding a
file-truename
to thelsp-f-canonical
fixes this issue.