diff options
Diffstat (limited to 'xml/impl/src/com/intellij/codeInsight')
5 files changed, 16 insertions, 6 deletions
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java index 656a061b9b4a..bd0d76c42d38 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java @@ -38,7 +38,7 @@ public class XmlEqTypedHandler extends TypedHandlerDelegate { PsiElement at = file.findElementAt(editor.getCaretModel().getOffset() - 1); PsiElement atParent = at != null ? at.getParent() : null; if(atParent instanceof XmlAttribute && ((XmlAttribute)atParent).getValueElement() == null) { - needToInsertQuotes = atParent instanceof XmlAttribute && ((XmlAttribute)atParent).getValueElement() == null; + needToInsertQuotes = ((XmlAttribute)atParent).getValueElement() == null; } } } diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java index c5e0ff307a94..729e6062c626 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java @@ -15,6 +15,7 @@ */ package com.intellij.codeInsight.editorActions; +import com.intellij.application.options.editor.WebEditorOptions; import com.intellij.lang.ASTNode; import com.intellij.lang.xml.XMLLanguage; import com.intellij.openapi.editor.Editor; @@ -71,6 +72,7 @@ public class XmlSlashTypedHandler extends TypedHandlerDelegate { @Override public Result charTyped(final char c, final Project project, @NotNull final Editor editor, @NotNull final PsiFile editedFile) { + if (!WebEditorOptions.getInstance().isAutoCloseTag()) return Result.CONTINUE; if ((editedFile.getLanguage() instanceof XMLLanguage || editedFile.getViewProvider().getBaseLanguage() instanceof XMLLanguage) && c == '/') { PsiDocumentManager.getInstance(project).commitAllDocuments(); diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetParser.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetParser.java index 6bc71f9f8549..aa7e62cbcd54 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetParser.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetParser.java @@ -80,6 +80,10 @@ public abstract class EmmetParser { ZenCodingNode mul = parseMul(); ZenCodingToken operationToken = getToken(); + if (operationToken == ZenCodingTokens.OPENING_R_BRACKET) { + mul = new MoreOperationNode(notNullNode(mul), parseExpression()); + operationToken = getToken(); + } if (!(operationToken instanceof OperationToken)) { return mul; } @@ -132,7 +136,7 @@ public abstract class EmmetParser { @Nullable private ZenCodingNode parseMul() { - ZenCodingNode exp = parseExpressionInBraces(); + ZenCodingNode exp = parseExpression(); if (exp == null) { return null; } @@ -153,7 +157,7 @@ public abstract class EmmetParser { } @Nullable - private ZenCodingNode parseExpressionInBraces() { + private ZenCodingNode parseExpression() { ZenCodingToken token = getToken(); if (token == ZenCodingTokens.OPENING_R_BRACKET) { advance(); diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java index 4ab715a404bf..01ddc3ca563f 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java @@ -202,7 +202,7 @@ public class XmlEmmetParser extends EmmetParser { int loremWordsCount = DEFAULT_LOREM_LENGTH; if (matcher.groupCount() > 1) { String group = matcher.group(2); - loremWordsCount = group.isEmpty() ? DEFAULT_LOREM_LENGTH : Integer.parseInt(group); + loremWordsCount = group == null || group.isEmpty() ? DEFAULT_LOREM_LENGTH : Integer.parseInt(group); } final List<Couple<String>> attrList = parseSelectors(); diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MoreOperationNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MoreOperationNode.java index 0a1bea140d6b..56d440abc538 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MoreOperationNode.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MoreOperationNode.java @@ -89,8 +89,12 @@ public class MoreOperationNode extends ZenCodingNode { } return result; } - List<GenerationNode> leftGenNodes = myLeftOperand.expand(numberInIteration, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, - parent); + List<GenerationNode> leftGenNodes = myLeftOperand.expand(numberInIteration, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, parent); + + if (leftGenNodes.isEmpty()) { + return myRightOperand.expand(numberInIteration, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, parent); + } + for (GenerationNode leftGenNode : leftGenNodes) { myRightOperand.expand(numberInIteration,totalIterations , surroundedText, callback, insertSurroundedTextAtTheEnd, leftGenNode); } |