[PATCH] D77311: clang-format: [JS] detect C++ keywords.

2020-04-02 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. mprobst added a reviewer: krasimir. Herald added subscribers: cfe-commits, jfb. Herald added a project: clang. C++ defines a number of keywords that are regular identifiers in JavaScript, e.g. `concept`: const concept = 1; // legit JS This change expands the exis

[PATCH] D77311: clang-format: [JS] detect C++ keywords.

2020-04-03 Thread Martin Probst via Phabricator via cfe-commits
mprobst added a comment. Thanks for the feedback. Indeed, whitelisting the JS keywords is better, but we still needed a way to blacklist all C++ keywords then - Krasimir's suggestion with the #include did the trick, thanks. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION htt

[PATCH] D77311: clang-format: [JS] detect C++ keywords.

2020-04-03 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 254741. mprobst added a comment. - fix formatting Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77311/new/ https://reviews.llvm.org/D77311 Files: clang/lib/Format/FormatToken.h clang/lib/Format/TokenAnnota

[PATCH] D77311: clang-format: [JS] detect C++ keywords.

2020-04-03 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 254740. mprobst added a comment. - - improve handling of keywors - rather than blacklisting all C++ Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77311/new/ https://reviews.llvm.org/D77311 Files: clang/lib/F

[PATCH] D69971: clang-format: [JS] support null operators.

2019-11-07 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. mprobst added a reviewer: krasimir. Herald added a project: clang. 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

[PATCH] D69972: clang-format: [JS] test declared fields.

2019-11-07 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. mprobst added a reviewer: krasimir. Herald added a project: clang. 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. Repository: r

[PATCH] D69971: clang-format: [JS] support null operators.

2019-11-08 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 228495. mprobst added a comment. Add tests for .?(foo) and .?[foo]. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D69971/new/ https://reviews.llvm.org/D69971 Files: clang/lib/Format/FormatToken.h clang/lib/

[PATCH] D69972: clang-format: [JS] test declared fields.

2019-11-11 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG6bcd8d4a18fc: clang-format: [JS] test declared fields. (authored by mprobst). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D69972/new/ https://reviews.llvm.

[PATCH] D69971: clang-format: [JS] support null operators.

2019-11-11 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGa7638d384983: clang-format: [JS] support null operators. (authored by mprobst). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D69971/new/ https://reviews.llv

[PATCH] D70377: clang-format: [JS] tests for async wrapping.

2019-11-18 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. mprobst added a reviewer: krasimir. Herald added a project: clang. Herald added a subscriber: cfe-commits. Adds tests to ensure that `async method() ...` does not wrap between async and the method name, which would cause automatic semicolon insertion. Repository:

[PATCH] D73768: clang-format: [JS] document InsertTrailingCommas.

2020-02-02 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGdc04c54fc1f6: clang-format: [JS] document InsertTrailingCommas. (authored by mprobst). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73768/new/ https://revi

[PATCH] D73354: clang-format: insert trailing commas into containers.

2020-02-03 Thread Martin Probst via Phabricator via cfe-commits
mprobst closed this revision. mprobst marked an inline comment as done. mprobst added a comment. This has landed as https://reviews.llvm.org/rGa324fcf1ae6 (not sure why this hasn't closed automatically). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org

[PATCH] D72827: clang-format: [JS] Handle keyword-named methods.

2020-01-17 Thread Martin Probst via Phabricator via cfe-commits
mprobst added a comment. I've added tests and a fix for try/catch and if/else. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D72827/new/ https://reviews.llvm.org/D72827 ___ cfe-commits mailing list cfe-

[PATCH] D72827: clang-format: [JS] Handle keyword-named methods.

2020-01-17 Thread Martin Probst via Phabricator via cfe-commits
mprobst added a comment. In D72827#1823895 , @krasimir wrote: > How about `if` and `try`? Is there a list somewhere for all such valid > identifiers? This is a bit annoying - generally speaking, we should parse all keywords in declaration locations as

[PATCH] D72827: clang-format: [JS] Handle keyword-named methods.

2020-01-17 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG0734fb21ed5e: clang-format: [JS] Handle more keyword-named methods. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D72827?vs=238442&id=238713#toc Repository: rG LLVM Github

[PATCH] D72907: clang-format: [JS] pragmas for tslint, tsc.

2020-01-17 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. mprobst added a reviewer: krasimir. mprobst added a project: clang. 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 iso

[PATCH] D72911: clang-format: fix spacing in `operator const char*()`

2020-01-17 Thread Martin Probst via Phabricator via cfe-commits
mprobst accepted this revision. mprobst added inline comments. This revision is now accepted and ready to land. Comment at: clang/lib/Format/TokenAnnotator.cpp:2717 +// operator Foo*() +// dependant on PointerAlignment style. + typo dependent

[PATCH] D72907: clang-format: [JS] pragmas for tslint, tsc.

2020-01-17 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG9835cf159014: clang-format: [JS] pragmas for tslint, tsc. (authored by mprobst). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D72907/new/ https://reviews.ll

[PATCH] D73026: clang-format: [JS] fix `??` opreator wrapping.

2020-01-20 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. mprobst added a reviewer: krasimir. Herald added a project: clang. 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 terna

[PATCH] D73026: clang-format: [JS] fix `??` opreator wrapping.

2020-01-20 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG4c9d6914453d: clang-format: [JS] fix `??` opreator wrapping. (authored by mprobst). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73026/new/ https://reviews

[PATCH] D73335: clang-format: [JS] options for arrow functions.

2020-01-24 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. mprobst added a reviewer: krasimir. Herald added a project: clang. clang-format currently always wraps the body of non-empty arrow functions: const x = () => { z(); }; This change implements support for the `AllowShortLambdasOnASingleLine` style options, an

[PATCH] D73335: clang-format: [JS] options for arrow functions.

2020-01-24 Thread Martin Probst via Phabricator via cfe-commits
mprobst added a comment. FYI I've started a conversation on whether `SLS_All` should be the default Google style. But the option I think is useful in either case. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73335/new/ https://reviews.llvm.org/D7

[PATCH] D73354: clang-format: insert trailing commas into containers.

2020-01-24 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. mprobst added reviewers: krasimir, MyDeveloperDay. Herald added a project: clang. 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 imple

[PATCH] D73354: clang-format: insert trailing commas into containers.

2020-01-24 Thread Martin Probst via Phabricator via cfe-commits
mprobst added a comment. This is required by JavaScript style, but this change as is optimistically runs the tool for any language. I think that's probably not what we want here initially, just throwing it out there. WDYT? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION http

[PATCH] D73354: clang-format: insert trailing commas into containers.

2020-01-24 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 240194. mprobst added a comment. - - only run comma insertion for JavaScript. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73354/new/ https://reviews.llvm.org/D73354 Files: clang/include/clang/Format/Format

[PATCH] D73335: clang-format: [JS] options for arrow functions.

2020-01-24 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 240202. mprobst added a comment. - Disable arrow functions on single lines by default. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73335/new/ https://reviews.llvm.org/D73335 Files: clang/lib/Format/Format.

[PATCH] D73335: clang-format: [JS] options for arrow functions.

2020-01-24 Thread Martin Probst via Phabricator via cfe-commits
mprobst added a comment. > If that's the case, consider adding the option to the style in a follow-up > patch: > > GoogleStyle.AllowShortLambdasOnASingleLine = FormatStyle::SLS_All; > > > that would have an advantage of making clear which test case diffs are result > of the implementatio

[PATCH] D73335: clang-format: [JS] options for arrow functions.

2020-01-27 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG02656f29abda: clang-format: [JS] options for arrow functions. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D73335?vs=240202&id=240575#toc Repository: rG LLVM Github Monore

[PATCH] D73354: clang-format: insert trailing commas into containers.

2020-01-28 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 240847. mprobst marked 16 inline comments as done. mprobst added a comment. - - only run comma insertion for JavaScript. - review fixes - Fix col limit - test for comma insertion Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://revi

[PATCH] D73354: clang-format: insert trailing commas into containers.

2020-01-28 Thread Martin Probst via Phabricator via cfe-commits
mprobst marked 3 inline comments as done. mprobst added inline comments. Comment at: clang/include/clang/Format/Format.h:552 +/// Insert trailing commas in container literals that were wrapped over +/// multiple lines. +TCS_Wrapped, sammccall wrote: >

[PATCH] D73335: clang-format: [JS] options for arrow functions.

2020-01-28 Thread Martin Probst via Phabricator via cfe-commits
mprobst marked 2 inline comments as done. mprobst added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:3165 + } +} + RKSimon wrote: > @mprobst - this is breaking buildbots: > http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-and

[PATCH] D73354: clang-format: insert trailing commas into containers.

2020-01-28 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 240873. mprobst marked an inline comment as done. mprobst added a comment. - - only run comma insertion for JavaScript. - review fixes - Fix col limit - test for comma insertion - - validate options, reject bin packing + trailing commas Repository: rG LLVM

[PATCH] D73354: clang-format: insert trailing commas into containers.

2020-01-28 Thread Martin Probst via Phabricator via cfe-commits
mprobst marked 6 inline comments as done. mprobst added a comment. PTAL. Comment at: clang/include/clang/Format/Format.h:552 +/// Insert trailing commas in container literals that were wrapped over +/// multiple lines. +TCS_Wrapped, mprobst wrote: >

[PATCH] D73354: clang-format: insert trailing commas into containers.

2020-01-29 Thread Martin Probst via Phabricator via cfe-commits
mprobst marked 2 inline comments as done. mprobst added inline comments. Comment at: clang/lib/Format/Format.cpp:2531 +}); + auto Env = MyDeveloperDay wrote: > Ok, this comment is more a discussion point rather than a review comment. Was > there a reason

[PATCH] D73354: clang-format: insert trailing commas into containers.

2020-01-29 Thread Martin Probst via Phabricator via cfe-commits
mprobst marked 4 inline comments as done. mprobst added inline comments. Comment at: clang/include/clang/Format/Format.h:42 + Unsuitable, + BinBackTrailingCommaConflict +}; sammccall wrote: > Back->Pack? That's what you get when you fix my auto-complete: consis

[PATCH] D73768: clang-format: [JS] document InsertTrailingCommas.

2020-01-31 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. mprobst added a reviewer: MyDeveloperDay. Herald added a project: clang. Herald added a subscriber: cfe-commits. In release notes and the regular docs. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D73768 Files: clang/docs/ClangFormatStyleOptio

[PATCH] D40178: clang-format: [JS] remove trailing lines in arrow functions.

2017-11-17 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. clang-format already removes lines trailing at the end of blocks: function x() { foo(); // next line will be removed. } However because JS arrow functions are parsed as expressions, the existing logic to remove empty l

[PATCH] D40178: clang-format: [JS] remove trailing lines in arrow functions.

2017-11-17 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 123367. mprobst added a comment. - handle C++ lambdas - handle preceding empty lines https://reviews.llvm.org/D40178 Files: lib/Format/ContinuationIndenter.cpp lib/Format/UnwrappedLineFormatter.cpp unittests/Format/FormatTest.cpp unittests/Format/Fo

[PATCH] D40178: clang-format: [JS] remove trailing lines in arrow functions.

2017-11-17 Thread Martin Probst via Phabricator via cfe-commits
mprobst added a comment. In https://reviews.llvm.org/D40178#928645, @djasper wrote: > Is this different for C++ lambdas? I would think that we never should add an > empty line before the "}" of a child block. Actually indeed turns out to be identical for C++ lambdas. Fixed as we discussed off

[PATCH] D40178: clang-format: [JS] remove trailing lines in arrow functions.

2017-11-17 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 123368. mprobst added a comment. - reduce test cases a bit, no need to separate before/after cases https://reviews.llvm.org/D40178 Files: lib/Format/ContinuationIndenter.cpp lib/Format/UnwrappedLineFormatter.cpp unittests/Format/FormatTest.cpp unitt

[PATCH] D40178: clang-format: [JS] remove trailing lines in arrow functions.

2017-11-17 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 123370. mprobst added a comment. - document the meaning if Children.size() == 0 in this context. https://reviews.llvm.org/D40178 Files: lib/Format/ContinuationIndenter.cpp lib/Format/UnwrappedLineFormatter.cpp unittests/Format/FormatTest.cpp unittes

[PATCH] D40178: clang-format: [JS] remove trailing lines in arrow functions.

2017-11-17 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 123371. mprobst added a comment. - prefer !x.empty() over .size() > 0. https://reviews.llvm.org/D40178 Files: lib/Format/ContinuationIndenter.cpp lib/Format/UnwrappedLineFormatter.cpp unittests/Format/FormatTest.cpp unittests/Format/FormatTestJS.cpp

[PATCH] D40178: clang-format: [JS] remove trailing lines in arrow functions.

2017-11-17 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL318537: clang-format: remove trailing lines in lamdas and arrow functions. (authored by mprobst). Repository: rL LLVM https://reviews.llvm.org/D40178 Files: cfe/trunk/lib/Format/ContinuationIndenter

[PATCH] D28246: clang-format: [JS] avoid indent after ambient function declarations.

2017-01-03 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. mprobst added a reviewer: djasper. mprobst added a subscriber: cfe-commits. Herald added a subscriber: klimek. Before: declare function foo(); let x = 1; After: declare function foo(); let x = 1; The problem was that clang-format would unconditionally t

[PATCH] D28246: clang-format: [JS] avoid indent after ambient function declarations.

2017-01-04 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 83028. mprobst added a comment. - Handle type declarations. https://reviews.llvm.org/D28246 Files: lib/Format/UnwrappedLineParser.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatTestJS.cpp ==

[PATCH] D28246: clang-format: [JS] avoid indent after ambient function declarations.

2017-01-04 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 83038. mprobst added a comment. - Handle type declarations. - test for object literal return types https://reviews.llvm.org/D28246 Files: lib/Format/UnwrappedLineParser.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatTestJS.cpp ===

[PATCH] D28246: clang-format: [JS] avoid indent after ambient function declarations.

2017-01-04 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL290959: clang-format: [JS] avoid indent after ambient function declarations. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D28246?vs=83038&id=83039#toc Repository: rL LLVM

[PATCH] D28246: clang-format: [JS] avoid indent after ambient function declarations.

2017-01-04 Thread Martin Probst via Phabricator via cfe-commits
mprobst marked an inline comment as done. mprobst added inline comments. Comment at: unittests/Format/FormatTestJS.cpp:382 + "let x = 1;\n"); + verifyFormat("declare function foo(): string;\n" + "let x = 1;\n"); sammccall wrote: > May

[PATCH] D28465: clang-format: [JS] ASI after imports

2017-01-09 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. mprobst added a reviewer: klimek. mprobst added a subscriber: cfe-commits. Automatic semicolon insertion should break import and export statements: Before, this would format on one line: // Note: no semi after 'x' below! import {x} from 'x' export function fo

[PATCH] D28465: clang-format: [JS] ASI after imports

2017-01-09 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL291428: clang-format: [JS] ASI after imports (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D28465?vs=83593&id=83594#toc Repository: rL LLVM https://reviews.llvm.org/D28465

[PATCH] D30932: [clang-format] disabled adding extra space after MSVC '__super' keyword

2017-03-16 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL297936: [clang-format] disable adding extra space after MSVC '__super' keyword (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D30932?vs=91733&id=91982#toc Repository: rL LLV

[PATCH] D30932: [clang-format] disabled adding extra space after MSVC '__super' keyword

2017-03-16 Thread Martin Probst via Phabricator via cfe-commits
mprobst added a comment. @jutocz done, thanks for the patch! Repository: rL LLVM https://reviews.llvm.org/D30932 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31698: clang-format: [JS] fix whitespace around "of" operator.

2017-04-04 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. Previously: import {of } from 'x'; of (null); Now: import {of} from 'x'; of(null); https://reviews.llvm.org/D31698 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/Fo

[PATCH] D31698: clang-format: [JS] fix whitespace around "of" operator.

2017-04-05 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 94188. mprobst added a comment. - improve comment https://reviews.llvm.org/D31698 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatTestJS.cpp =

[PATCH] D31698: clang-format: [JS] fix whitespace around "of" operator.

2017-04-05 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL299533: clang-format: [JS] fix whitespace around "of" operator. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D31698?vs=94188&id=94189#toc Repository: rL LLVM https://revi

[PATCH] D28763: clang-format: [JS] revert over-eager ASI check.

2017-01-16 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. mprobst added a reviewer: djasper. mprobst added subscribers: cfe-commits, sammccall. Herald added a subscriber: klimek. Change r291428 introduced ASI detection after closing curly braces. That would generally be correct, however this breaks indentation for structur

[PATCH] D28763: clang-format: [JS] revert over-eager ASI check.

2017-01-16 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL292099: clang-format: [JS] revert over-eager ASI check. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D28763?vs=84527&id=84528#toc Repository: rL LLVM https://reviews.llvm

[PATCH] D29186: clang-format: [JS] do not format MPEG transport streams.

2017-01-26 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. The MPEG transport stream file format also uses ".ts" as its file extension. This change detects its specific framing format (0x47 every 189 bytes) and simply ignores MPEG TS files. https://reviews.llvm.org/D29186 Files: tools/

[PATCH] D29186: clang-format: [JS] do not format MPEG transport streams.

2017-01-26 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 85934. mprobst added a comment. - Move MPEG check into Format.cpp. https://reviews.llvm.org/D29186 Files: lib/Format/Format.cpp tools/clang-format/ClangFormat.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatTestJS.cpp ===

[PATCH] D29186: clang-format: [JS] do not format MPEG transport streams.

2017-01-26 Thread Martin Probst via Phabricator via cfe-commits
mprobst added a comment. PTAL, moved the check down a bit. https://reviews.llvm.org/D29186 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D29186: clang-format: [JS] do not format MPEG transport streams.

2017-01-27 Thread Martin Probst via Phabricator via cfe-commits
mprobst added a comment. In https://reviews.llvm.org/D29186#657828, @alexeagle wrote: > confused, wasn't this committed last year? is this an extra check? I think I fixed this in tslint, but not in clang-format. At least I cannot find a trace of it (but yeah, I thought I had fixed it, too).

[PATCH] D29186: clang-format: [JS] do not format MPEG transport streams.

2017-01-27 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL293270: clang-format: [JS] do not format MPEG transport streams. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D29186?vs=85934&id=86028#toc Repository: rL LLVM https://rev

[PATCH] D29634: clang-format: [JS] exclaim preceding regex literals.

2017-02-07 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. Regex detection would incorrectly classify a trailing `!` operator (nullability cast) followed by a `/` as the start of a regular expression literal. This fixes code such as: var foo = x()! / 10; Which would previously parse a r

[PATCH] D29635: clang-format: [JS] handle parenthesized class expressions.

2017-02-07 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. In JavaScript, classes are expressions, so they can appear e.g. in argument lists. var C = foo(class { bar() { return 1; } }; https://reviews.llvm.org/D29635 Files: lib/Format/UnwrappedLineParser.cpp unitte

[PATCH] D29635: clang-format: [JS] handle parenthesized class expressions.

2017-02-07 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 87412. mprobst added a comment. - Parse nested classes as child expressions. https://reviews.llvm.org/D29635 Files: lib/Format/UnwrappedLineParser.cpp lib/Format/UnwrappedLineParser.h unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatT

[PATCH] D29635: clang-format: [JS] handle parenthesized class expressions.

2017-02-07 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL294302: clang-format: [JS] handle parenthesized class expressions. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D29635?vs=87412&id=87416#toc Repository: rL LLVM https://r

[PATCH] D29634: clang-format: [JS] exclaim preceding regex literals.

2017-02-07 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL294304: clang-format: [JS] exclaim preceding regex literals. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D29634?vs=87402&id=87417#toc Repository: rL LLVM https://reviews

[PATCH] D29656: clang-format: [JS] correcly format object literal methods.

2017-02-07 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. In JavaScript, object literals can contain methods: var x = { a() { return 1; }, }; Previously, clang-format always parsed nested {} inside a braced list as further braced lists. Special case this logic for JavaScript to t

[PATCH] D29656: clang-format: [JS] correcly format object literal methods.

2017-02-07 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL294315: clang-format: [JS] correcly format object literal methods. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D29656?vs=87456&id=87462#toc Repository: rL LLVM https://r

[PATCH] D35683: [clang-format] Put '/**' and '*/' on own lines in multiline jsdocs

2017-07-20 Thread Martin Probst via Phabricator via cfe-commits
mprobst added inline comments. Comment at: lib/Format/BreakableToken.cpp:435 + // Detect a multiline jsdoc comment and set DelimitersOnNewline in that case. + if (Style.Language == FormatStyle::LK_JavaScript) { +if ((Lines[0] == "*" || Lines[0].startswith("* ")) && Lines.si

[PATCH] D35683: [clang-format] Put '/**' and '*/' on own lines in multiline jsdocs

2017-07-20 Thread Martin Probst via Phabricator via cfe-commits
mprobst accepted this revision. mprobst added inline comments. This revision is now accepted and ready to land. Comment at: lib/Format/BreakableToken.cpp:436 + if (Style.Language == FormatStyle::LK_JavaScript) { +if ((Lines[0] == "*" || Lines[0].startswith("* ")) && Lines.si

[PATCH] D42570: clang-format: [JS] Prevent ASI before [ and (.

2018-01-26 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. mprobst added a reviewer: djasper. Herald added a subscriber: klimek. JavaScript automatic semicolon insertion can trigger before [ and (, so avoid breaking before them if the previous token is likely to terminate an expression. Repository: rC Clang https://revi

[PATCH] D42570: clang-format: [JS] Prevent ASI before [ and (.

2018-01-26 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL323532: clang-format: [JS] Prevent ASI before [ and (. (authored by mprobst, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D42570 Files: cfe/t

[PATCH] D30399: clang-format: [JS] whitespace after async in arrow functions.

2017-02-27 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. Async arrow functions should be marked with a whitespace after the async keyword, before the parameter list: x = async () => foo(); Before: x = async() => foo(); This makes it easier to tell apart an async arrow function fr

[PATCH] D30399: clang-format: [JS] whitespace after async in arrow functions.

2017-02-27 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 89859. mprobst added a comment. - Extract local variable for next non comment. https://reviews.llvm.org/D30399 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatTestJS.cpp

[PATCH] D30399: clang-format: [JS] whitespace after async in arrow functions.

2017-02-27 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL296330: clang-format: [JS] whitespace after async in arrow functions. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D30399?vs=89859&id=89860#toc Repository: rL LLVM https:

[PATCH] D30452: Blacklist @mods and several other JSDoc tags from wrapping.

2017-02-28 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. Limit the blacklisting to only apply when the tag is actually followed by a parameter in curly braces. /** @mods {long.type.must.not.wrap} */ vs /** @const this is a long description that may wrap. */ JSDoc tag reference he

[PATCH] D30452: Blacklist @mods and several other JSDoc tags from wrapping.

2017-02-28 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 8. mprobst added a comment. - Match \\w* for all JSDoc param tags. https://reviews.llvm.org/D30452 Files: lib/Format/Format.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatTestJS.cpp

[PATCH] D30452: Blacklist @mods and several other JSDoc tags from wrapping.

2017-02-28 Thread Martin Probst via Phabricator via cfe-commits
mprobst marked an inline comment as done. mprobst added inline comments. Comment at: lib/Format/Format.cpp:624 +// taze:, and @tag followed by { for a lot of JSDoc tags. +GoogleStyle.CommentPragmas = "(taze:|(@[A-Za-z_0-9-]*[ \\t]*{))"; GoogleStyle.MaxEmptyLinesToKee

[PATCH] D30452: Blacklist @mods and several other JSDoc tags from wrapping.

2017-02-28 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL296467: Blacklist arbitrary @\\w+ JSDoc tags from wrapping. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D30452?vs=8&id=90001#toc Repository: rL LLVM https://reviews.

[PATCH] D30697: [clang-format] Enable comment reflowing in multiline comments containing pragmas

2017-03-07 Thread Martin Probst via Phabricator via cfe-commits
mprobst accepted this revision. mprobst added a comment. This revision is now accepted and ready to land. LGTM. https://reviews.llvm.org/D30697 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[PATCH] D30705: clang-format: [JS] allow breaking after non-null assertions.

2017-03-07 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. Previously clang-format would not break after any !. However in TypeScript, ! can be used as a post fix operator for non-nullability: x.foo()!.bar()!; With this change, clang-format will wrap after the ! if it is likely a post-

[PATCH] D30705: clang-format: [JS] allow breaking after non-null assertions.

2017-03-07 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 90889. mprobst added a comment. - Introduce TT_JsNonNullAssertion to centralize determining token types. https://reviews.llvm.org/D30705 Files: lib/Format/FormatToken.h lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestJS.cpp Index: unittests

[PATCH] D30705: clang-format: [JS] allow breaking after non-null assertions.

2017-03-08 Thread Martin Probst via Phabricator via cfe-commits
mprobst marked 2 inline comments as done. mprobst added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:1056 +} else if (Current.is(tok::exclaim)) { + if (Style.Language == FormatStyle::LK_JavaScript) { +if (Current.Previous && djasper

[PATCH] D30705: clang-format: [JS] allow breaking after non-null assertions.

2017-03-08 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 90988. mprobst marked an inline comment as done. mprobst added a comment. - Introduce TT_JsNonNullAssertion to centralize determining token types. - Move up language specific code in determineTokenType. https://reviews.llvm.org/D30705 Files: lib/Format/Fo

[PATCH] D30874: clang-format: [JS] do not wrap after interface and type.

2017-03-12 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. `interface` and `type` are pseudo keywords and cause automatic semicolon insertion when followed by a line break: interface // gets parsed as a long variable access to "interface" VeryLongInterfaceName { } With this

[PATCH] D30874: clang-format: [JS] do not wrap after interface and type.

2017-03-13 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL297605: clang-format: [JS] do not wrap after interface and type. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D30874?vs=91500&id=91519#toc Repository: rL LLVM https://rev

[PATCH] D30705: clang-format: [JS] allow breaking after non-null assertions.

2017-03-13 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL297606: clang-format: [JS] allow breaking after non-null assertions. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D30705?vs=90988&id=91526#toc Repository: rL LLVM https:/

[PATCH] D30883: clang-format: [JS] do not wrap @see tags.

2017-03-13 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. @see is special among JSDoc tags in that it is commonly followed by URLs. The JSDoc spec suggests that users should wrap URLs in an additional {@link url...} tag (@see http://usejsdoc.org/tags-see.html), but this is very commonly

[PATCH] D30883: clang-format: [JS] do not wrap @see tags.

2017-03-13 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL297607: clang-format: [JS] do not wrap @see tags. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D30883?vs=91527&id=91529#toc Repository: rL LLVM https://reviews.llvm.org/D

[PATCH] D32531: clang-format: [JS] prevent wraps before class members.

2017-04-26 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. In JavaScript/TypeScript, class member definitions that use modifiers can be subject to Automatic Semicolon Insertion (ASI). For example, "class X { get \n foo }" defines a property called "get" and a property called "foo", both w

[PATCH] D32532: clang-format: [JS/Java] ignore Objective-C constructs in JS & Java.

2017-04-26 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. Java and JavaScript support annotations and decorators, respectively, that use a leading "@" token. clang-format currently detects this as an Objective-C construct and applies special formatting, for example no whitespace around "

[PATCH] D32531: clang-format: [JS] prevent wraps before class members.

2017-04-26 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 96712. mprobst added a comment. - formatting https://reviews.llvm.org/D32531 Files: lib/Format/FormatToken.h lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatTestJS.cpp ===

[PATCH] D32531: clang-format: [JS] prevent wraps before class members.

2017-04-26 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL301397: clang-format: [JS] prevent wraps before class members. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D32531?vs=96712&id=96719#toc Repository: rL LLVM https://revie

[PATCH] D32532: clang-format: [JS/Java] ignore Objective-C constructs in JS & Java.

2017-04-26 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL301399: clang-format: [JS/Java] ignore Objective-C constructs in JS & Java. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D32532?vs=96710&id=96720#toc Repository: rL LLVM

[PATCH] D32590: clang-format: [JS] parse async function declarations.

2017-04-27 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. Previously, clang-format would accidentally parse an async function declaration as a function expression, and thus not insert an unwrapped line for async functions, causing subsequent functions to run into the function: async fun

[PATCH] D32590: clang-format: [JS] parse async function declarations.

2017-04-27 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 96908. mprobst added a comment. - capitalization https://reviews.llvm.org/D32590 Files: lib/Format/UnwrappedLineParser.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatTestJS.cpp =

[PATCH] D32590: clang-format: [JS] parse async function declarations.

2017-04-27 Thread Martin Probst via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL301538: clang-format: [JS] parse async function declarations. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D32590?vs=96908&id=96909#toc Repository: rL LLVM https://review

[PATCH] D32864: clang-format: [JS] exponentiation operator

2017-05-04 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision. Herald added a subscriber: klimek. While its precedence should be higher than multiplicative, LLVM does not have a level for that, so for the time being just treat it as multiplicative. https://reviews.llvm.org/D32864 Files: lib/Format/FormatToken.h lib/Forma

[PATCH] D32864: clang-format: [JS] exponentiation operator

2017-05-04 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 97829. mprobst added a comment. - support **= https://reviews.llvm.org/D32864 Files: lib/Format/FormatToken.h lib/Format/FormatTokenLexer.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatTestJS.cpp

<    1   2   3   >