Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-29 Thread Martin Probst via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL271185: clang-format: [JS] Support shebang lines on the very first line. (authored by mprobst). Changed prior to commit: http://reviews.llvm.org/D20632?vs=58612&id=58916#toc Repository: rL LLVM http

Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-29 Thread Daniel Jasper via cfe-commits
djasper accepted this revision. djasper added a comment. Looks good. http://reviews.llvm.org/D20632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-27 Thread Martin Probst via cfe-commits
mprobst added a comment. Alex, do you accept this revision? http://reviews.llvm.org/D20632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-27 Thread Alex Eagle via cfe-commits
alexeagle added a comment. ping @djasper we need this fix in order to format angular 2 repo again http://reviews.llvm.org/D20632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-26 Thread Martin Probst via cfe-commits
mprobst updated this revision to Diff 58612. mprobst marked an inline comment as done. mprobst added a comment. revert FormatTokenLexer, restrict to first token http://reviews.llvm.org/D20632 Files: lib/Format/FormatToken.h lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestJS.cpp

Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-26 Thread Martin Probst via cfe-commits
mprobst marked 2 inline comments as done. Comment at: lib/Format/TokenAnnotator.cpp:698 @@ +697,3 @@ + +if (Style.Language == FormatStyle::LK_JavaScript) { + // JavaScript files can contain shebang lines of the form: alexeagle wrote: > should we still res

Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-25 Thread Alex Eagle via cfe-commits
alexeagle added a subscriber: alexeagle. Comment at: lib/Format/FormatTokenLexer.cpp:23 @@ -22,1 +22,3 @@ +#include "llvm/Support/Debug.h" + revert this file Comment at: lib/Format/TokenAnnotator.cpp:698 @@ +697,3 @@ + +if (Style.Language =

Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-25 Thread Martin Probst via cfe-commits
mprobst updated this revision to Diff 58529. mprobst added a comment. - use #include style shebang parsing. http://reviews.llvm.org/D20632 Files: lib/Format/FormatTokenLexer.cpp lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatTestJS.cpp =

Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-25 Thread Daniel Jasper via cfe-commits
djasper added a comment. That's the same for #include directives (with <>). Just turn the tokens into TT_ImplicitStringLiteral, same as is done for #includes. I am not saying it's better, but I don't think we should have to different approaches.. http://reviews.llvm.org/D20632 _

Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-25 Thread Martin Probst via cfe-commits
mprobst added a comment. How would I disable the formatting using that way? When I special case `parsePreprocessorDirective()`, consume the line, and return `LT_ImportStatement`, clang-format still tries to format tokens within the shebang. E.g. I get `#!/usr/bin / env node`, note the whitespac

Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-25 Thread Daniel Jasper via cfe-commits
djasper added a comment. Thinking some more, I think this is actually very close to what we do for #include(-like) statements. That is done in TokenAnnotator::parseLine() and TokenAnnotator::parseIncludeDirective(). Could you move the logic there? http://reviews.llvm.org/D20632

[PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-25 Thread Martin Probst via cfe-commits
mprobst created this revision. mprobst added a reviewer: djasper. mprobst added a subscriber: cfe-commits. Herald added a subscriber: klimek. Shebang lines (`#!/bin/blah`) can be used in JavaScript scripts to indicate they should be run using e.g. node. This change treats # lines on the first line