Revision tags: llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2 |
|
#
6e28b86c |
| 21-Dec-2021 |
mydeveloperday <mydeveloperday@gmail.com> |
AlignConsecutiveDeclarations not working for 'const' keyword in JavsScript
https://github.com/llvm/llvm-project/issues/49846
Fixes #49846
AlignConsecutiveDeclarations is not working for "let" and
AlignConsecutiveDeclarations not working for 'const' keyword in JavsScript
https://github.com/llvm/llvm-project/issues/49846
Fixes #49846
AlignConsecutiveDeclarations is not working for "let" and "const" in JavaScript
let letVariable = 5; const constVariable = 10;
Reviewed By: owenpan, HazardyKnusperkeks, curdeius
Differential Revision: https://reviews.llvm.org/D115990
show more ...
|
#
327d9663 |
| 03-Dec-2021 |
Martin Probst <martin@probst.io> |
clang-format: [JS] test case for numeric separators.
ES2021 allows numeric literals using `_` as a separator. This already works, but had no test.
Differential Revision: https://reviews.llvm.org/D1
clang-format: [JS] test case for numeric separators.
ES2021 allows numeric literals using `_` as a separator. This already works, but had no test.
Differential Revision: https://reviews.llvm.org/D115147
show more ...
|
Revision tags: llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2 |
|
#
e708808f |
| 25-Aug-2021 |
Jan Kuehle <jankuehle@google.com> |
[clang-format] Support TypeScript override keyword
TypeScript 4.3 added a new "override" keyword for class members. This lets clang-format know about it, so it can format code using it properly.
Re
[clang-format] Support TypeScript override keyword
TypeScript 4.3 added a new "override" keyword for class members. This lets clang-format know about it, so it can format code using it properly.
Reviewed By: krasimir
Differential Revision: https://reviews.llvm.org/D108692
show more ...
|
#
befb9dc3 |
| 24-Aug-2021 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] keep TypeScript argument decorators in line
As a follow-up from https://reviews.llvm.org/D108538, ensure TypeScript argument decorators are kept in line with the argument.
Reviewed B
[clang-format] keep TypeScript argument decorators in line
As a follow-up from https://reviews.llvm.org/D108538, ensure TypeScript argument decorators are kept in line with the argument.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D108620
show more ...
|
#
f3671a68 |
| 23-Aug-2021 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] break after the closing paren of a TypeScript decoration
This fixes up a regression we found from https://reviews.llvm.org/D107267: in specific contexts, clang-format stopped breaking
[clang-format] break after the closing paren of a TypeScript decoration
This fixes up a regression we found from https://reviews.llvm.org/D107267: in specific contexts, clang-format stopped breaking after the `)` in TypeScript decorations. There were no test cases covering this, so I added one.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D108538
show more ...
|
#
4f4f2783 |
| 03-Aug-2021 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] don't break between function and function name in JS
The patch https://reviews.llvm.org/D105964 (https://github.com/llvm/llvm-project/commit/58494c856a15f5b0e886c7baf5d505ac6c05dfe5)
[clang-format] don't break between function and function name in JS
The patch https://reviews.llvm.org/D105964 (https://github.com/llvm/llvm-project/commit/58494c856a15f5b0e886c7baf5d505ac6c05dfe5) updated detection of function declaration names. It had the unfortunate consequence that it started breaking between `function` and the function name in some cases in JavaScript code.
This patch addresses this.
Reviewed By: MyDeveloperDay, owenpan
Differential Revision: https://reviews.llvm.org/D107267
show more ...
|
Revision tags: llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1 |
|
#
70ae843d |
| 21-Apr-2021 |
Martin Probst <martin@probst.io> |
clang-format: [JS] do not wrap after `asserts`
`asserts` is a pseudo keyword in TypeScript used in return types. Wrapping after it triggers automatic semicolon insertion, which breaks the code seman
clang-format: [JS] do not wrap after `asserts`
`asserts` is a pseudo keyword in TypeScript used in return types. Wrapping after it triggers automatic semicolon insertion, which breaks the code semantics/syntax.
`asserts` is different from other pseudo keywords in that it is specific to TS and only carries meaning in a very specific location. Thus introducing a token type is probably overkill.
Differential Revision: https://reviews.llvm.org/D100953
show more ...
|
Revision tags: llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4 |
|
#
2b30bd2b |
| 29-Mar-2021 |
Martin Probst <martin@probst.io> |
clang-format: [JS] do not collapse - - to --.
In JavaScript, `- -1;` is legal syntax, the language allows unary minus. However the two tokens must not collapse together: `--1` is prefix decrement, i
clang-format: [JS] do not collapse - - to --.
In JavaScript, `- -1;` is legal syntax, the language allows unary minus. However the two tokens must not collapse together: `--1` is prefix decrement, i.e. different syntax.
Before:
- -1; ==> --1;
After:
- -1; ==> - -1;
This change makes no attempt to format this "nicely", given by all likelihood this represents a programming mistake by the user, or odd generated code.
The check is not guarded by language: this appears to be a problem in Java as well, and will also be beneficial when formatting syntactically incorrect C++ (e.g. during editing).
Differential Revision: https://reviews.llvm.org/D99495
show more ...
|
Revision tags: llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1 |
|
#
77b48411 |
| 11-Nov-2020 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] do not break before @tags in JS comments
In JavaScript breaking before a `@tag` in a comment puts it on a new line, and machinery that parses these comments will fail to understand su
[clang-format] do not break before @tags in JS comments
In JavaScript breaking before a `@tag` in a comment puts it on a new line, and machinery that parses these comments will fail to understand such comments.
This adapts clang-format to not break before `@`. Similar functionality exists for not breaking before `{`.
Reviewed By: mprobst
Differential Revision: https://reviews.llvm.org/D91078
show more ...
|
#
16212b8b |
| 10-Nov-2020 |
Martin Probst <martin@probst.io> |
clang-format: [JS] support new assignment operators.
Before:
a && = b;
After:
a &&= b;
These operators are new additions in ES2021.
Differential Revision: https://reviews.llvm.org/D91132
|
#
2dbcbd35 |
| 06-Nov-2020 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] do not break before { in JS comments
In JavaScript some @tags can be followed by `{`, and machinery that parses these comments will fail to understand the comment if followed by a lin
[clang-format] do not break before { in JS comments
In JavaScript some @tags can be followed by `{`, and machinery that parses these comments will fail to understand the comment if followed by a line break.
clang-format already handles this case by not breaking before `{` in comments. However this was not working in cases when the column limit falls within `@tag` or between `@tag` and `{`. This adapts clang-format for this case.
Reviewed By: mprobst
Differential Revision: https://reviews.llvm.org/D90908
show more ...
|
Revision tags: llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2, llvmorg-10.0.1-rc1, llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1, llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2, llvmorg-8.0.1-rc1, llvmorg-8.0.0, llvmorg-8.0.0-rc5, llvmorg-8.0.0-rc4, llvmorg-8.0.0-rc3, llvmorg-7.1.0, llvmorg-7.1.0-rc1, llvmorg-8.0.0-rc2, llvmorg-8.0.0-rc1, llvmorg-7.0.1, llvmorg-7.0.1-rc3, llvmorg-7.0.1-rc2, llvmorg-7.0.1-rc1, llvmorg-7.0.0, llvmorg-7.0.0-rc3, llvmorg-7.0.0-rc2, llvmorg-7.0.0-rc1, llvmorg-6.0.1, llvmorg-6.0.1-rc3, llvmorg-6.0.1-rc2, llvmorg-6.0.1-rc1, llvmorg-5.0.2, llvmorg-5.0.2-rc2, llvmorg-5.0.2-rc1, llvmorg-6.0.0, llvmorg-6.0.0-rc3, llvmorg-6.0.0-rc2, llvmorg-6.0.0-rc1, llvmorg-5.0.1, llvmorg-5.0.1-rc3, llvmorg-5.0.1-rc2, llvmorg-5.0.1-rc1, llvmorg-5.0.0, llvmorg-5.0.0-rc5, llvmorg-5.0.0-rc4, llvmorg-5.0.0-rc3, llvmorg-5.0.0-rc2, llvmorg-5.0.0-rc1, llvmorg-4.0.1, llvmorg-4.0.1-rc3, llvmorg-4.0.1-rc2 |
|
#
0ee04e6e |
| 22-May-2017 |
Francois Ferrand <thetypz@gmail.com> |
[clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set
Summary: Even when BreakBeforeBinaryOperators is set, AlignOperands kept aligning the beginning of the line, even when it coul
[clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set
Summary: Even when BreakBeforeBinaryOperators is set, AlignOperands kept aligning the beginning of the line, even when it could align the actual operands (e.g. after an assignment).
With this patch, the operands are actually aligned, and the operator gets aligned with the equal sign:
int aaaaa = bbbbbb + cccccc;
This not happen in tests, to avoid 'breaking' the indentation:
if (aaaaa && bbbbb) return;
Reviewers: krasimir, djasper, klimek, MyDeveloperDay
Reviewed By: MyDeveloperDay
Subscribers: MyDeveloperDay, acoomans, cfe-commits, klimek
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D32478
show more ...
|
#
ece7e95f |
| 02-May-2020 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] NFC - clang-format the FormatTests
Summary: Ensure the clang-format unit tests are themselves clang-formatted
Having areas of the llvm code which are clang-format clean, give us more
[clang-format] NFC - clang-format the FormatTests
Summary: Ensure the clang-format unit tests are themselves clang-formatted
Having areas of the llvm code which are clang-format clean, give us more areas to run new clang-format binaries on ensuring we haven't broken anything.
It seems to me we SHOULD have this clang-formatted at a minimum, otherwise how can we expect others to use clang-format if we "don't eat our own dogfood", also if the tests are dependent on the formatting of the code then that would also be bad!
Reviewed By: sammccall
Subscribers: cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D79204
show more ...
|
#
47ef09e4 |
| 23-Apr-2020 |
Haojian Wu <hokein.wu@gmail.com> |
Revert "clang-format: support aligned nested conditionals formatting"
This reverts 3d61b1120e8267aa39f4c9a33d618dbaec4ec6fa, 5daa25fd7a184524759b6ad065a8bd7e95aa149a
The clang-format test (FormatTe
Revert "clang-format: support aligned nested conditionals formatting"
This reverts 3d61b1120e8267aa39f4c9a33d618dbaec4ec6fa, 5daa25fd7a184524759b6ad065a8bd7e95aa149a
The clang-format test (FormatTest.ConfigurableUseOfTab) is failing in the buildbot:
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/31811/steps/ninja%20check%201/logs/stdio
show more ...
|
#
3d61b112 |
| 22-May-2017 |
Francois Ferrand <thetypz@gmail.com> |
clang-format: Introduce stricter AlignOperands flag
Summary: Even when BreakBeforeBinaryOperators is set, AlignOperands kept aligning the beginning of the line, even when it could align the actual o
clang-format: Introduce stricter AlignOperands flag
Summary: Even when BreakBeforeBinaryOperators is set, AlignOperands kept aligning the beginning of the line, even when it could align the actual operands (e.g. after an assignment).
With this patch, there is an option to actually align the operands, so that the operator gets right-aligned with the equal sign or return operator:
int aaaaa = bbbbbb + cccccc; return aaaaaaa && bbbbbbb;
This not happen in parentheses, to avoid 'breaking' the indentation:
if (aaaaa && bbbbb) return;
Reviewers: krasimir, djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D32478
show more ...
|
#
92201505 |
| 06-Apr-2020 |
Martin Probst <martin@probst.io> |
clang-format: [JS] handle pseudo-keywords.
Summary: The previous change in https://reviews.llvm.org/D77311 attempted to detect more C++ keywords. However it also precisely detected all JavaScript ke
clang-format: [JS] handle pseudo-keywords.
Summary: The previous change in https://reviews.llvm.org/D77311 attempted to detect more C++ keywords. However it also precisely detected all JavaScript keywords. That's generally correct, but many JavaScripy keywords, e.g. `get`, are so-called pseudo-keywords. They can be used in positions where a keyword would never be legal, e.g. in a dotted expression:
x.type; // type is a pseudo-keyword, but can be used here. x.get; // same for get etc.
This change introduces an additional parameter to `IsJavaScriptIdentifier`, allowing clients to toggle whether they want to allow `IdentifierName` tokens, i.e. pseudo-keywords.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77548
show more ...
|
#
146d685c |
| 02-Apr-2020 |
Martin Probst <martin@probst.io> |
clang-format: [JS] detect C++ keywords.
Summary: C++ defines a number of keywords that are regular identifiers in JavaScript, e.g. `concept`:
const concept = 1; // legit JS
This change expands
clang-format: [JS] detect C++ keywords.
Summary: C++ defines a number of keywords that are regular identifiers in JavaScript, e.g. `concept`:
const concept = 1; // legit JS
This change expands the existing `IsJavaScriptIdentifier(Tok)` function to return false for C++ keywords that aren't keywords in JS.
Reviewers: krasimir
Subscribers: jfb, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77311
show more ...
|
#
a324fcf1 |
| 24-Jan-2020 |
Martin Probst <martin@probst.io> |
clang-format: insert trailing commas into containers.
Summary: This change adds an option to insert trailing commas into container literals. For example, in JavaScript:
const x = [ a,
clang-format: insert trailing commas into containers.
Summary: This change adds an option to insert trailing commas into container literals. For example, in JavaScript:
const x = [ a, b, ^~~~~ inserted if missing. ]
This is implemented as a seperate post-processing pass after formatting (because formatting might change whether the container literal does or does not wrap). This keeps the code relatively simple and orthogonal, though it has the notable drawback that the newly inserted comma is not taken into account for formatting decisions (e.g. it might exceed the 80 char limit). To avoid exceeding the ColumnLimit, a comma is only inserted if it fits into the limit.
Trailing comma insertion conceptually conflicts with argument bin-packing: inserting a comma disables bin-packing, so we cannot do both. clang-format rejects FormatStyle configurations that do both with this change.
Reviewers: krasimir, MyDeveloperDay
Subscribers: cfe-commits
Tags: #clang
show more ...
|
#
02656f29 |
| 24-Jan-2020 |
Martin Probst <martin@probst.io> |
clang-format: [JS] options for arrow functions.
Summary: clang-format currently always wraps the body of non-empty arrow functions:
const x = () => { z(); };
This change implements s
clang-format: [JS] options for arrow functions.
Summary: clang-format currently always wraps the body of non-empty arrow functions:
const x = () => { z(); };
This change implements support for the `AllowShortLambdasOnASingleLine` style options, controlling the indent style for arrow function bodies that have one or fewer statements. SLS_All puts all on a single line, SLS_Inline only arrow functions used in an inline position.
const x = () => { z(); };
Multi-statement arrow functions continue to be wrapped. Function expressions (`a = function() {}`) and function/method declarations are unaffected as well.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73335
show more ...
|
#
4c9d6914 |
| 20-Jan-2020 |
Martin Probst <martin@probst.io> |
clang-format: [JS] fix `??` opreator wrapping.
Summary: clang-format currently treats the nullish coalescing operator `??` like the ternary operator. That causes multiple nullish terms to be each in
clang-format: [JS] fix `??` opreator wrapping.
Summary: clang-format currently treats the nullish coalescing operator `??` like the ternary operator. That causes multiple nullish terms to be each indented relative to the last `??`, as they would in a ternary.
The `??` operator is often used in chains though, and as such more similar to other binary operators, such as `||`. So to fix the indent, set its token type to `||`, so it inherits the same treatment.
This opens up the question of operator precedence. However, `??` is required to be parenthesized when mixed with `||` and `&&`, so this is not a problem that can come up in syntactically legal code.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73026
show more ...
|
#
9835cf15 |
| 17-Jan-2020 |
Martin Probst <martin@probst.io> |
clang-format: [JS] pragmas for tslint, tsc.
Summary: tslint and tsc (the TypeScript compiler itself) use comment pragmas of the style:
// tslint:disable-next-line:foo // @ts-ignore
These must
clang-format: [JS] pragmas for tslint, tsc.
Summary: tslint and tsc (the TypeScript compiler itself) use comment pragmas of the style:
// tslint:disable-next-line:foo // @ts-ignore
These must not be wrapped and must stay on their own line, in isolation. For tslint, this required adding it to the pragma regexp. The comments starting with `@` are already left alone, but this change adds test coverage for them.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72907
show more ...
|
#
0734fb21 |
| 16-Jan-2020 |
Martin Probst <martin@probst.io> |
clang-format: [JS] Handle more keyword-named methods.
Summary: Including `do`, `for`, and `while`, `if`, `else`, `try`, `catch`, in addition to the previously handled fields. The unit test explicitl
clang-format: [JS] Handle more keyword-named methods.
Summary: Including `do`, `for`, and `while`, `if`, `else`, `try`, `catch`, in addition to the previously handled fields. The unit test explicitly uses methods, but this code path handles both fields and methods.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72827
show more ...
|
#
736a3802 |
| 18-Nov-2019 |
Martin Probst <martin@probst.io> |
clang-format: [JS] tests for async wrapping.
Summary: Adds tests to ensure that `async method() ...` does not wrap between async and the method name, which would cause automatic semicolon insertion.
clang-format: [JS] tests for async wrapping.
Summary: Adds tests to ensure that `async method() ...` does not wrap between async and the method name, which would cause automatic semicolon insertion.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70377
show more ...
|
#
6bcd8d4a |
| 07-Nov-2019 |
Martin Probst <martin@probst.io> |
clang-format: [JS] test declared fields.
Summary: TypeScript now supports declaring fields:
class Foo { declare field: string; }
clang-format happens to already format this fine, so
clang-format: [JS] test declared fields.
Summary: TypeScript now supports declaring fields:
class Foo { declare field: string; }
clang-format happens to already format this fine, so this change just adds a regression test.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69972
show more ...
|
#
a7638d38 |
| 07-Nov-2019 |
Martin Probst <martin@probst.io> |
clang-format: [JS] support null operators.
Summary: JavaScript / TypeScript is adding two new operators: the null propagating operator `?.` and the nullish coalescing operator `??`.
const x = f
clang-format: [JS] support null operators.
Summary: JavaScript / TypeScript is adding two new operators: the null propagating operator `?.` and the nullish coalescing operator `??`.
const x = foo ?? 'default'; const z = foo?.bar?.baz;
This change adds support to lex and format both.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69971
show more ...
|