restore space in Python line comment prefix (PY-10929); re-fix PY-9840 correctly

This commit is contained in:
Dmitry Jemerov
2013-11-04 15:41:08 +01:00
parent a00e03f643
commit 4ca7cb7e98
4 changed files with 4 additions and 3 deletions

View File

@@ -48,6 +48,7 @@ public class EnterInLineCommentHandler extends EnterHandlerDelegateAdapter {
if (offset < document.getTextLength() && text.charAt(offset) != '\n') {
String prefix = commenter.getLineCommentPrefix();
assert prefix != null: "Line Comment type is set but Line Comment Prefix is null!";
prefix = prefix.trim();
if (!StringUtil.startsWith(text, offset, prefix)) {
if (text.charAt(caretOffset) != ' ' && !prefix.endsWith(" ")) {
prefix += " ";

View File

@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
*/
public class PythonCommenter implements CodeDocumentationAwareCommenter, IndentedCommenter {
public String getLineCommentPrefix() {
return "#";
return "# ";
}
public String getBlockCommentPrefix() {

View File

@@ -1,3 +1,3 @@
def foo():
#i = 1
# i = 1
j = 2

View File

@@ -1,2 +1,2 @@
#noinspection PyUnresolvedReferences
# noinspection PyUnresolvedReferences
print x<caret>xx