mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed shebang formatting (PY-12775).
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user