Fixed shebang formatting (PY-12775).

This commit is contained in:
Dmitry Trofimov
2014-06-10 14:16:47 +04:00
parent 2a1a7c85e7
commit 08cab53d7e
4 changed files with 9 additions and 0 deletions
@@ -84,6 +84,9 @@ public class PyPreFormatProcessor implements PreFormatProcessor {
String text = element.getText();
int commentStart = text.indexOf('#');
if (commentStart != -1 && (commentStart + 1) < text.length()) {
if (text.charAt(commentStart+1) == '!') {
return; //shebang
}
String commentText = StringUtil.trimLeading(text.substring(commentStart + 1));
String newText = "# " + commentText;
+1
View File
@@ -0,0 +1 @@
#!/usr/bin/python3
@@ -0,0 +1 @@
#!/usr/bin/python3
@@ -398,6 +398,10 @@ public class PyFormatterTest extends PyTestCase {
doTest();
}
public void testShebang() { //PY-12775
doTest();
}
private void doTest() {
doTest(false);
}