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

Not respecting and format in the eclipse configurations. #348

Open
alirana01 opened this issue Jun 13, 2024 · 4 comments
Open

Not respecting and format in the eclipse configurations. #348

alirana01 opened this issue Jun 13, 2024 · 4 comments

Comments

@alirana01
Copy link

Which ever format I try to select from the preferences in eclipse
C/C++ -> Code Style -> Formatter

I see that the editor is always going back to some default formatter like K&R.

It would be helpful if you can provide someway to make that work. Maybe I am missing something. Also let me know if there are some changes required in the implementation or point me to the particular file you are using for the formatting and I can see if in our integration we can change it in a way to utalize the code style from eclipse

@ghentschke
Copy link
Contributor

The formatting in the new LSP based editor relies on a .clang-format file in the source file folder or its parents (e.g. a .clang-format file in the project root will be used for all source files in the project)

Here is a little documentation how its works.

The format info comes from the clangd language server. The formatting defined in the .clang-format will also be applied via the Ctrl+Shift+F shortcut or via the context menu in the editor:
image

@ghentschke
Copy link
Contributor

@alirana01
Copy link
Author

@ghentschke thanks for the quick response can you please also let me know why the color formatting is not working in the eclipse as well?

@ghentschke
Copy link
Contributor

Which editor are u using? In the old editor you can run the formatter via context menu:
image
Or you can tell Eclipse to format your file on file save:
image

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

2 participants