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-ignore not being used #13005

Open
jalanh11640 opened this issue Nov 27, 2024 · 2 comments
Open

.clang-format-ignore not being used #13005

jalanh11640 opened this issue Nov 27, 2024 · 2 comments

Comments

@jalanh11640
Copy link

Environment

  • OS and Version: macOS Sequoia 15.2
  • VS Code Version: 1.95.3 (Universal)
  • C/C++ Extension Version: v1.22.11
  • If using SSH remote, specify OS of remote machine: N/A

Bug Summary and Steps to Reproduce

Bug Summary: When using Format Document from the (right click) context menu, the active file is formatted when that file is listed in .clang-format-ignore.

Steps to reproduce:

  1. Create test.cpp in root of project with contents of
#include <iostream>

int main(int argc, char *argv[])
{
  int value = 5;
  int x = 0;

  return 0;
}
  1. Create .clang-format file in root of project with contents of AlignConsecutiveAssignments: true
  2. Create .clang-format-ignore file in the root of the project with the absolute path to test.cpp
  3. Open test.cpp in editor, right click and select Format Document
  4. Notice that file has been updated with the formatting specified in .clang-format

If you run clang-format -i test.cpp in the integrated kernel, the file's format is not updated.

Expected behavior: File should not be formatted

Configuration and Logs

I have no c_cpp_properties.json.  Log diagnostics show the clang-format command as:
/Users/jeff/.vscode/extensions/ms-vscode.cpptools-1.22.11-darwin-arm64/bin/../LLVM/bin/clang-format -style=file -fallback-style=LLVM --Wno-error=unknown -assume-filename=/Users/jeff/Development/clang-format/test.cpp

Other Extensions

No response

Additional context

No response

@sean-mcmanus
Copy link
Contributor

@jalanh11640 This appears to be clang-format bug llvm/llvm-project#113099 . It looks like the fix will be available in clang-format 20.x.

@jalanh11640
Copy link
Author

@jalanh11640 This appears to be clang-format bug llvm/llvm-project#113099 . It looks like the fix will be available in clang-format 20.x.

Thanks, I’ll look forward to when that version of clang-format is pulled into the extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants