-
Couldn't load subscription status.
- Fork 274
If the workspace folder is a symlink, convert paths relative to it #314
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
Conversation
|
I've noticed similar issue before, however this change doesn't fix it.
No, Emacs with lsp-mode uses whatever path the file was originally opened at. It seems that symlink gets resolved somewhere in ccls (maybe clang?). Here is ccls log (built from rev.
|
|
Sorry, my last comment is probably misleading. I looked into lsp-mode and it seems to have issues with symlinks. I'll look into it. |
Thanks for the clarification. I've checked vanilla |
|
Root cause is in |
|
I tried the latest ccls with my original setup and still see the same issues. I do use projectile as well and that does seem to be a likely culprit since the symlink modifies the project root location (the links are not internal to the project). I'll follow that issue, thanks @ilysym |
madscientist had a good summary in #242 (comment)
Suppose
/tmp/realis a project. Consider different symlink types./tmp/symlink -> /tmp/realThe project root directory may be a symlink. The decision whether the symlink should be followed is on the client side.Some editors (vim) follow symlinks => The root is
/tmp/realand the paths ccls receives are always resolved. There is no tricky thing in the interaction between the client and ccls. However, but we still have to ensure that"directory""filename"paths are followed when parsingcompile_commands.json.If the editor doesn't (Emacs, VSCode), ccls should use
/tmp/symlink/a.ccas the canonical path, instead of/tmp/real/a.cc. In this case, the user had better not open/tmp/real/a.ccdirectly (I'll call it "unsolicited open"), as it raises the question whether the symlink and the target should be considered the same file. The most sensible approach (which this PR does) is probably to convert every/tmp/real/path to/tmp/symlink/(there is some weird thing in VSCode: it opens two buffers and the second one may does not have semantic highlight)/tmp/real/a.h -> /tmp/real/b.hSome files/directories under the root directory are symlinks. Ideallya.handb.hshould be considered different but it is impossible in clang internals. It always follows links and thinks the file isb.h./tmp/real/sub -> /tmp/sub/tmp/subis another project but embedded in/tmp/real. After you jump from a/tmp/real/buffer to a/tmp/subbuffer, you may find the two buffers are disconnected. You may also unsolicitedly open/tmp/subbuffers and find them disconneted from other/tmp/real/buffers. IIRC no known client has good support for this (but I can hack emacs lsp-mode to do the sane thing!) Configure your client to make/tmp/real/suba workspace folder (it is nested under the root/tmp/realbut it is allowed!), then ccls will convert/tmp/subpaths to/tmp/real/sub. In addition, you have to hack your language client so that when it sees/tmp/sub, it sends requests to the ccls process with the root/tmp/real. This hack may not be easy in your client, though.