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

Set .clang-format file as fallback #641

Closed
Chillee opened this issue Apr 17, 2017 · 12 comments
Closed

Set .clang-format file as fallback #641

Chillee opened this issue Apr 17, 2017 · 12 comments
Labels
Feature Request fixed Check the Milestone for the release in which the fix is or will be available. Language Service

Comments

@Chillee
Copy link

Chillee commented Apr 17, 2017

I have a set of formatting options I like to use across projects, but doesn't quite align with any of the provided format. It would be an appreciated feature if I could provide one as a fallback.

I may take a crack at implementing this myself.

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Apr 17, 2017

clang-format itself doesn't allow setting the fallback_style to something custom but we could add that feature ourselves, like we did for the "Visual Studio" fallback_style, but allowing arbitrary styles in the same format as the "style" property. E.g.
"C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: LLVM, UseTab: Always }".
Would that be okay or did you want a path to a settings file?

@Chillee
Copy link
Author

Chillee commented Apr 17, 2017

I originally meant the second one, but I think your suggestion would be preferable.

I noticed this extension doesn't have the source on this repository; is there no way for me to contribute this feature myself?

@sean-mcmanus
Copy link
Contributor

Unfortunately, the extension is closed source.

@Chillee
Copy link
Author

Chillee commented Apr 18, 2017

Well, that's unfortunate. Any particular reason why?

Either way, appreciate the responsiveness, and hope to see this feature in a future release!

@sean-mcmanus
Copy link
Contributor

See #457 for a discussion on why our extension is not "open source".

@sean-mcmanus
Copy link
Contributor

This was added in 0.11.0, but bug #604 will always cause the .clang-format file to not be looked at on Linux/Mac (which we plan to fix "soon").

@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Apr 25, 2017
@Chillee
Copy link
Author

Chillee commented Apr 25, 2017

Thank you! It's really useful for me since I'm typically writing a lot of different small c++ projects.

@rivalak
Copy link

rivalak commented Aug 25, 2019

Why set > "C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: LLVM, UseTab: Always }"
cannot help me.

@sean-mcmanus
Copy link
Contributor

@rivalak I don't understand what you're asking. Can you open a new issue with more info?

@rivalak
Copy link

rivalak commented Sep 4, 2019

@rivalak I don't understand what you're asking. Can you open a new issue with more info?

@sean-mcmanus Sorry to my late. I just cannot use the google format in my vscode by configuring the .clang-format, I don't know why, this really bother me. 😭

@sean-mcmanus
Copy link
Contributor

The .clang-format file should be picked up if it's in the workspace folder or a parent path. It's possible some error is occurring that is causing it to not be used. Can you enable debug logging to see if it shows any errors? What version of clang-format.exe are you using? We currently ship with 6.0 (we should probably update 9.0 after it's released).

@rivalak
Copy link

rivalak commented Sep 9, 2019

@sean-mcmanus Thanks for your advice. I am using 6.0 version of clang-format. I find "ctrl + shift + I" works well as my wish. And the issues about the format of auto-complete code snippets maybe caused by the 'Intellisense' extension.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature Request fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

3 participants