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
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
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
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
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
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
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 =
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
=
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
_
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
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
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
12 matches
Mail list logo