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

Support emitting realpaths in compile_commands.json #612

Open
andrewbraxton opened this issue Dec 29, 2024 · 4 comments
Open

Support emitting realpaths in compile_commands.json #612

andrewbraxton opened this issue Dec 29, 2024 · 4 comments

Comments

@andrewbraxton
Copy link

andrewbraxton commented Dec 29, 2024

Clangd suffers from a collection of issues when it comes to symlinks in compile_commands.json, for example:

There doesn't seem to be much inertia towards fixing this in clangd. My suggestion for bear is to have a way to resolve all symlinks and emit only realpaths in compile_commands.json, particularly for the "file" key which is important for go-to-definition functionality. This could come in the form of a flag called something like --resolve-symlinks, or maybe a field in the "output" section of the config file.

@rizsotto
Copy link
Owner

Thanks @andrewbraxton for this report.

Will implement this in the 4.0 version. My plan is to control this aspect from the config file.

@rizsotto
Copy link
Owner

@andrewbraxton question for you: is realpath needs to be absolute path? Or that could be relative too?

I am planning to make this as a configuration parameter. And I am wondering if this is represented in a single parameter or with multiple parameters. A single parameter could be: "keep the original", "make it relative", "make it absolute", "make it realpath". A multiple parameter could be something like: "relative", "absolute" and the other parameter can have values like: "realpath", "no change".

@andrewbraxton
Copy link
Author

I don't have a preference for single vs multiple parameters, but in either case I'd probably always configure it to use absolute paths anyway. I'm not sure what the use case for using relative paths would be.

@Morozov-5F
Copy link

@andrewbraxton @rizsotto Would be really cool to have it configurable both for absolute and relative. My usecase is that I build the code under the docker container and due to several reasons I cannot match the filesystem layout in docker container and in the host system. So I would really prefer having the relative realpath in the compile_commands.json.

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

No branches or pull requests

3 participants