-
Notifications
You must be signed in to change notification settings - Fork 15k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorclang-formatgood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute
Description
With clang-format
built from the head of main
and the following .clang-format
file, which should fully disable formatting for JSON files:
---
Language: Json
DisableFormat: true
The following file:
{
"key": "value"
}
Is reformatted as follows, with a spurious binding that results in invalid JSON:
x = {
"key": "value"
}
With DisableFormat: false
or no .clang-format
file at all, the binding is not added to the file.
Research note: This issue is a result of the way that clang-format
implements JSON formatting by adding a binding to the top-level object in order to force clang::format
to treat the code as plain JavaScript. I have already tracked down the issue and am currently preparing a patch.
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorclang-formatgood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute