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

Allow clang-format path configuration in project settings #36

Open
lassiniemisto opened this issue Sep 3, 2018 · 6 comments
Open

Allow clang-format path configuration in project settings #36

lassiniemisto opened this issue Sep 3, 2018 · 6 comments

Comments

@lassiniemisto
Copy link

For managing toolchains for older versions of our product, it would be great to be able to store the clang-format executable path in the project settings and not in the workspace settings.

This would also ease up using a version controlled Eclipse project with non-standard clang-format command: everything else comes from the project itself but now we need to manually set up clang-format path for the workspace.

@AhmetBilgin
Copy link

I implemented this on my fork for java formatting:
AhmetBilgin@a5a6f09

@julian-poidevin
Copy link

julian-poidevin commented Jun 23, 2021

Hello @AhmetBilgin, could you submit a PR to this project implementing this feature ? Would love to have it ! Thanks a lot.

@AhmetBilgin
Copy link

AhmetBilgin commented Jun 24, 2021

Hi @julian-poidevin, I had to use another account to fork this project again. Can you test this? Seems to work for me.
https://github.com/Nosezeichen/CppStyle/tree/master/update/target/site
When it's ok I'll make a Pull-Request.

@julian-poidevin
Copy link

julian-poidevin commented Jun 26, 2021

Hi @AhmetBilgin, thanks for taking the time to do this.
I've installed your modified version of the CppStyle extension and re-configured the path.
Unfortunately I don't see the project file being modified with the settings.

I'm using STM32CubeIDE, is your patch compatible with this modified version of Eclipse ? The project file has a .cproject extension

Also, I see your patch allows to set clang-format path with an environment variable env_var.
Would it work using Eclipse linked ressource as : ${PROJECT_LOC}.

I'd like to directly put the clang-format binary into a project folder so developers don't have to install LLVM and I'd like to set the clang-format path in the project settings as : ${PROJECT_LOC}/Utilities/clang-format.exe

Thanks a lot for your help on this !

image

@AhmetBilgin
Copy link

AhmetBilgin commented Jun 27, 2021

Hi @julian-poidevin,
I don't know why I said that I implemented the 'project specific settings' part...
You are right, with my changes you are able to to use ${env_var:SOMETHING} in all 3 fields (clang-format, .clang-format style and cpplint). You can even use multiple semicolon ';' seperated paths. The first valid one will be used. But these settings are only available at workspace level right now.

  • (A) I can have a look if I can implement this as project settings as well.

The environment variable resolving does currently only work for ${env_var:SOMETHING} and is resolved with System::getEnv and System::getproperty.

  • (B) I can have a look at resolving against the eclipse predefined path variables. This will get a little bit trickier, because I cache the first valid path until the path changes in the settings or eclipse is restarted. This won't work if you want different settings for different projects in the same workspace.

Which solution (A, B) would help with your requirements?

@julian-poidevin
Copy link

Wow, that's very nice from you suggesting your help ! 🙏🏻

Actually, solution (B) could help a lot. I would just have to store clang-format binary at the same place for all project.

Thanks a lot !

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