Skip to content
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

Add new macro WorkspaceRealPath #3544

Merged

Conversation

UffeJakobsen
Copy link
Contributor

Add new macro WorkspaceRealPath

The WorkspaceRealPath macro is identical to WorkspacePath - but just expanded/converted by calling FileUtils::RealPath (realpath()) - this means that any symlink present in the path is resolved.

Reasoning for introduction of WorkspaceRealPath macro:

I have a number of (FSW) projects that have to be placed on a network drive with a special and extremely long/deep directory layout (not my choice)

In order to eliminate the long/deep path leading to the project dirs of these projects - I have created a local project root with symlinks to the real projects - mission accomplished...

This has worked well with CodeLite until the switch from ctags to clangd (LSP)...

Here is an example of one the problems (there are actually more):

Clangd (LSP) returns filepaths as expanded (real)paths.

With a FSW project opened with a shortend (symlink) path - the Workspace pane file-tree does not recognize the expanded (real)path as a part of the FSW project - and hence it will not sync the file returned by LSP with the workspace pane file-tree.

But clangd (LSP) has a fix for that - path-mappings will translate a remote path into a local path (just what we (I) need)

By adding the following into the clangd (LSP) command every thing works again:

--path-mappings=$(WorkspacePath)=$(WorkspaceRealPath)

Summary:

By introducing the WorkspaceRealPath macro the problems of mapping between "virtual" symlink paths and (real)paths are automatically handled

@eranif
Copy link
Owner

eranif commented Dec 1, 2024

Nice! I have been struggling with similar issue myself :) (I am using FSW with SSH)
At work, my home drive is /local/home/... so clangd resolves all the path to their real paths, so i might end up with 2 files opened at CodeLite the one with realpath and the symlinked, sounds like your fix will resolve both issues

@eranif eranif merged commit baf7836 into eranif:master Dec 1, 2024
4 checks passed
@UffeJakobsen UffeJakobsen deleted the master_uj_macro_workspace_realpath branch December 1, 2024 23:20
@UffeJakobsen
Copy link
Contributor Author

UffeJakobsen commented Dec 1, 2024

Thanks for merging 👍

BTW: I have a few other patches that may be needed to cover all scenarios where editor ends up opening 2 tabs for the same file... but they need a little clean up before they can become into PR's :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants