[clang] dc04c54 - clang-format: [JS] document InsertTrailingCommas.
Martin Probst via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 2 23:52:06 PST 2020
Author: Martin Probst
Date: 2020-02-03T08:51:52+01:00
New Revision: dc04c54fc1f6660770040f9a17ea600ce95e4b60
URL: https://github.com/llvm/llvm-project/commit/dc04c54fc1f6660770040f9a17ea600ce95e4b60
DIFF: https://github.com/llvm/llvm-project/commit/dc04c54fc1f6660770040f9a17ea600ce95e4b60.diff
LOG: clang-format: [JS] document InsertTrailingCommas.
Summary: In release notes and the regular docs.
Reviewers: MyDeveloperDay
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73768
Added:
Modified:
clang/docs/ClangFormatStyleOptions.rst
clang/docs/ReleaseNotes.rst
Removed:
################################################################################
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index 981542451b29..0c515922e650 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -717,6 +717,26 @@ the configuration (without a prefix: ``Auto``).
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
}
+
+**InsertTrailingCommas** (``TrailingCommaStyle``) can be set to ``TCS_Wrapped``
+ to insert trailing commas in container literals (arrays and objects) that wrap
+ across multiple lines. It is currently only available for JavaScript and
+ disabled by default (``TCS_None``).
+
+ ``InsertTrailingCommas`` cannot be used together with ``BinPackArguments`` as
+ inserting the comma disables bin-packing.
+
+ .. code-block:: c++
+
+ TSC_Wrapped:
+ const someArray = [
+ aaaaaaaaaaaaaaaaaaaaaaaaaa,
+ aaaaaaaaaaaaaaaaaaaaaaaaaa,
+ aaaaaaaaaaaaaaaaaaaaaaaaaa,
+ // ^ inserted
+ ]
+
+
**BinPackParameters** (``bool``)
If ``false``, a function declaration's or function definition's
parameters will either all be on the same line or will have one line each.
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index eae0dfb12151..cb8d73932bf6 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -175,6 +175,11 @@ clang-format
}
}
+- Option ``InsertTrailingCommas`` can be set to ``TCS_Wrapped`` to insert
+ trailing commas in container literals (arrays and objects) that wrap across
+ multiple lines. It is currently only available for JavaScript and disabled by
+ default (``TCS_None``).
+
libclang
--------
More information about the cfe-commits
mailing list