fix JsonEditingTest: don't autoinsert comma if there's no value

This commit is contained in:
Anton Lobov
2018-04-21 10:44:31 +02:00
parent 04d43ad3a7
commit ceb2a546c4
2 changed files with 2 additions and 2 deletions

View File

@@ -66,7 +66,7 @@ public class JsonEnterHandler extends EnterHandlerDelegateAdapter {
prevSibling = prevSibling.getPrevSibling();
}
if (prevSibling instanceof JsonProperty) {
if (prevSibling instanceof JsonProperty && ((JsonProperty)prevSibling).getValue() != null) {
int offset = elementType == JsonElementTypes.COMMA ? nextSibling.getTextRange().getEndOffset() : prevSibling.getTextRange().getEndOffset();
if (elementType == JsonElementTypes.R_CURLY) {
editor.getDocument().insertString(offset, ",");

View File

@@ -1,6 +1,6 @@
{
"vcs": {
"schema": "schema://foo.bar/path"
}
},
<caret>
}