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

.clang-format file isn't used #604

Closed
viveksjain opened this issue Mar 31, 2017 · 15 comments
Closed

.clang-format file isn't used #604

viveksjain opened this issue Mar 31, 2017 · 15 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service

Comments

@viveksjain
Copy link

Running on Ubuntu 14.04, VSCode 1.10.2 and C++ extension 0.10.5. I seem to be having a similar issue to #196 - the flags passed to clang-format are
-style={ BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 2, BreakBeforeBraces: Allman, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0 } -fallback-style=LLVM
which means my actual .clang-format file is not used (should be -style=file). Where is this other style coming from and how can I fix it?

@viveksjain
Copy link
Author

viveksjain commented Mar 31, 2017

Just found #536 which is tangentially (but not exactly) related. It also says that issue is supposed to be fixed in 0.10.4, but my later version is still having this issue.

@viveksjain
Copy link
Author

Manually specifying the dict for C_Cpp.clang_format_style works, but setting it to "file" doesn't work.

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Mar 31, 2017

It's #571 , but I think we'll use this bug to track the issue, since the other bug mostly discusses another issue that I couldn't repro.

@sean-mcmanus sean-mcmanus added bug and removed duplicate labels Apr 3, 2017
@Binero
Copy link

Binero commented Apr 6, 2017

Can confirm this. Just running clang-format from the terminal works fine, VSC ignores it and always uses the fallback.

@rooomaa
Copy link

rooomaa commented Apr 8, 2017

same on ubuntu-16.04 & rhel-7.3 + vscode 1.11.1

@sean-mcmanus
Copy link
Contributor

The workaround is to change your clang_format_fallbackStyle to one of the non-"Visual Studio" presets, such as LLVM. But hopefully this will get fixed soon anyway.

@spencersutton
Copy link

The workaround is to change your clang_format_fallbackStyle to one of the non-"Visual Studio" presets, such as LLVM. But hopefully this will get fixed soon anyway.

That doesn't work for me but setting C_Cpp.clang_format_path to my system version of clang-format fixes it on macOS.

@sean-mcmanus
Copy link
Contributor

@spencersutton Ah, that's probably because your .clang-format has newer fields that aren't supported by the 3.8 version we ship, i.e. different root cause from the Linux/Mac-only issue.

@spencersutton
Copy link

spencersutton commented Apr 27, 2017

@sean-mcmanus You're right, I generated my .clang-format with clang-format --dump-config using my system clang-format. I found the version installed by vscode and ran it and got an error. There's no feedback in vscode if there's an error though.

It does work with default settings if I take the new option out.

@sean-mcmanus
Copy link
Contributor

@spencersutton I agree. We have a work item for exposing the clang-format error messages, but it's not expected to be fixed soon.

@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label May 5, 2017
@sean-mcmanus
Copy link
Contributor

The .clang-format not being detected when the Visual Studio fallback is used will be fixed in the next update. I'm not sure if we'll update the downloaded clang-format version. And we won't be exposing clang-format errors yet.

@xgalaxy
Copy link

xgalaxy commented May 17, 2017

I'm having this problem on Windows. The strange thing is I swear it was working earlier.
This is my clang format file:
https://gist.github.com/xgalaxy/e36910ba723849da146f705347a8adad

@sean-mcmanus
Copy link
Contributor

@xgalaxy Yeah, we should output the clang-format stderr somewhere. But as a workaround you can just run clang-format via the command line. In your example, TabWidth needs a colon, and FixNamespaceComments was added in clang-format 5.0 and we only ship 3.8-3.9, soon changing to 4.0, but you can change the C_Cpp.clang_format_path to your manually downloaded clang-format 5.0 if you want it to work.

@xgalaxy
Copy link

xgalaxy commented May 17, 2017

Crap totally missed the colon. Thank you.
And yea, I already point at a locally installed clang.

@bobbrow
Copy link
Member

bobbrow commented May 23, 2017

This was fixed in version 0.11.1. Please reopen if you continue to have this issue.

@bobbrow bobbrow closed this as completed May 23, 2017
@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
bug 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

7 participants