Skip to content

Commit

Permalink
IDEA-CR-17497
Browse files Browse the repository at this point in the history
  • Loading branch information
denofevil committed Jan 19, 2017
1 parent a28d278 commit d82365b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 2 additions & 4 deletions json/src/com/intellij/json/liveTemplates/JsonContextType.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ public boolean isInContext(@NotNull PsiFile file, int offset) {
@Override
public boolean accepts(@NotNull PsiElement element,
ProcessingContext context) {
return JsonPsiUtil.isPropertyKey(element) &&
element.getNextSibling() != null &&
element.getNextSibling().getNode().getElementType() == JsonElementTypes.COLON;
return JsonPsiUtil.isPropertyKey(element);
}
})));
})).beforeLeaf(psiElement(JsonElementTypes.COLON)));
return !illegalPattern.accepts(file.findElementAt(offset));
}
}
4 changes: 4 additions & 0 deletions json/tests/test/com/intellij/json/JsonLiveTemplateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public void testNotExpandableInsidePropertyKey() {
assertFalse(isApplicableContextUnderCaret("{fo<caret>o: \"bar\"}"));
}

public void testNotExpandableInsidePropertyKeyWithWhitespace() {
assertFalse(isApplicableContextUnderCaret("{fo<caret>o : \"bar\"}"));
}

public void testExpandableAtTopLevel() {
assertTrue(isApplicableContextUnderCaret("fo<caret>o"));
}
Expand Down

0 comments on commit d82365b

Please sign in to comment.