summaryrefslogtreecommitdiff
path: root/xml/impl/src
diff options
context:
space:
mode:
Diffstat (limited to 'xml/impl/src')
-rw-r--r--xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsForm.form21
-rw-r--r--xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsProvider.java6
-rw-r--r--xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java2
-rw-r--r--xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java2
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetParser.java8
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java2
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MoreOperationNode.java8
-rw-r--r--xml/impl/src/com/intellij/xml/arrangement/XmlArrangementVisitor.java2
-rw-r--r--xml/impl/src/com/intellij/xml/refactoring/SchemaPrefixRenameHandler.java19
-rw-r--r--xml/impl/src/com/intellij/xml/refactoring/XmlInlineHandler.java7
-rw-r--r--xml/impl/src/org/jetbrains/io/fastCgi/FastCgiChannelHandler.java9
11 files changed, 55 insertions, 31 deletions
diff --git a/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsForm.form b/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsForm.form
index bccba832488c..c24cc51f68f9 100644
--- a/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsForm.form
+++ b/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsForm.form
@@ -8,7 +8,7 @@
<properties/>
<border type="none"/>
<children>
- <grid id="247ce" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <grid id="247ce" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
@@ -24,7 +24,7 @@
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
- <text value="Automatically insert closing tag"/>
+ <text value="Insert closing tag on tag completion"/>
</properties>
</component>
<component id="9f825" class="javax.swing.JCheckBox" binding="myAutomaticallyInsertRequiredAttributesCheckBox" default-binding="true">
@@ -32,7 +32,7 @@
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
- <text value="Automatically insert required attributes"/>
+ <text value="Insert required attributes on tag completion"/>
</properties>
</component>
<component id="4bf74" class="javax.swing.JCheckBox" binding="myAutomaticallyStartAttributeAfterCheckBox" default-binding="true">
@@ -41,7 +41,7 @@
</constraints>
<properties>
<selected value="false"/>
- <text value="Automatically start attribute"/>
+ <text value="Start attribute on tag completion"/>
</properties>
</component>
<component id="c21d3" class="javax.swing.JCheckBox" binding="myAutomaticallyInsertRequiredSubTagsCheckBox" default-binding="true">
@@ -49,7 +49,7 @@
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
- <text value="Automatically insert required subtags"/>
+ <text value="Insert required subtags on tag completion"/>
</properties>
</component>
<component id="8169b" class="com.intellij.ui.components.JBCheckBox" binding="myAddQuotasForAttributeValue">
@@ -57,7 +57,16 @@
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
- <text value="Automatically add quotes for attribute value"/>
+ <text value="Add quotes for attribute value on typing '='"/>
+ </properties>
+ </component>
+ <component id="76e81" class="com.intellij.ui.components.JBCheckBox" binding="myAutoCloseTagCheckBox">
+ <constraints>
+ <grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <horizontalAlignment value="2"/>
+ <text value="Auto-close tag on typing '&lt;/'"/>
</properties>
</component>
</children>
diff --git a/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsProvider.java b/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsProvider.java
index 1341f95acd16..2202cc561c96 100644
--- a/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsProvider.java
+++ b/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsProvider.java
@@ -33,6 +33,7 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider {
private JCheckBox myAutomaticallyStartAttributeAfterCheckBox;
private JBCheckBox mySelectWholeCssIdentifierOnDoubleClick;
private JBCheckBox myAddQuotasForAttributeValue;
+ private JBCheckBox myAutoCloseTagCheckBox;
@Override
@@ -58,7 +59,8 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider {
xmlEditorOptions.isAutomaticallyStartAttribute() != myAutomaticallyStartAttributeAfterCheckBox.isSelected() ||
xmlEditorOptions.isSelectWholeCssIdentifierOnDoubleClick() != mySelectWholeCssIdentifierOnDoubleClick.isSelected() ||
xmlEditorOptions.isAutomaticallyInsertRequiredSubTags() != myAutomaticallyInsertRequiredSubTagsCheckBox.isSelected() ||
- xmlEditorOptions.isInsertQuotesForAttributeValue() != myAddQuotasForAttributeValue.isSelected();
+ xmlEditorOptions.isInsertQuotesForAttributeValue() != myAddQuotasForAttributeValue.isSelected() ||
+ xmlEditorOptions.isAutoCloseTag() != myAutoCloseTagCheckBox.isSelected();
}
@Override
@@ -70,6 +72,7 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider {
xmlEditorOptions.setAutomaticallyStartAttribute(myAutomaticallyStartAttributeAfterCheckBox.isSelected());
xmlEditorOptions.setSelectWholeCssIdentifierOnDoubleClick(mySelectWholeCssIdentifierOnDoubleClick.isSelected());
xmlEditorOptions.setInsertQuotesForAttributeValue(myAddQuotasForAttributeValue.isSelected());
+ xmlEditorOptions.setAutoCloseTag(myAutoCloseTagCheckBox.isSelected());
}
@Override
@@ -81,6 +84,7 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider {
myAutomaticallyStartAttributeAfterCheckBox.setSelected(xmlEditorOptions.isAutomaticallyStartAttribute());
mySelectWholeCssIdentifierOnDoubleClick.setSelected(xmlEditorOptions.isSelectWholeCssIdentifierOnDoubleClick());
myAddQuotasForAttributeValue.setSelected(xmlEditorOptions.isInsertQuotesForAttributeValue());
+ myAutoCloseTagCheckBox.setSelected(xmlEditorOptions.isAutoCloseTag());
}
@Override
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);
}
diff --git a/xml/impl/src/com/intellij/xml/arrangement/XmlArrangementVisitor.java b/xml/impl/src/com/intellij/xml/arrangement/XmlArrangementVisitor.java
index 7f118e889588..4055b9cffb9f 100644
--- a/xml/impl/src/com/intellij/xml/arrangement/XmlArrangementVisitor.java
+++ b/xml/impl/src/com/intellij/xml/arrangement/XmlArrangementVisitor.java
@@ -74,7 +74,7 @@ public class XmlArrangementVisitor extends XmlElementVisitor {
@Nullable String name,
@Nullable String namespace,
boolean canBeMatched) {
- if (!isWithinBounds(range)) {
+ if (range.getStartOffset() == 0 && range.getEndOffset() == 0 || !isWithinBounds(range)) {
return null;
}
final DefaultArrangementEntry current = getCurrent();
diff --git a/xml/impl/src/com/intellij/xml/refactoring/SchemaPrefixRenameHandler.java b/xml/impl/src/com/intellij/xml/refactoring/SchemaPrefixRenameHandler.java
index bc4ba667afa4..2c1f5a781fcb 100644
--- a/xml/impl/src/com/intellij/xml/refactoring/SchemaPrefixRenameHandler.java
+++ b/xml/impl/src/com/intellij/xml/refactoring/SchemaPrefixRenameHandler.java
@@ -15,7 +15,6 @@
*/
package com.intellij.xml.refactoring;
-import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
@@ -35,12 +34,6 @@ import java.util.Collection;
*/
public class SchemaPrefixRenameHandler extends VariableInplaceRenameHandler {
- @Override
- protected boolean isAvailable(PsiElement element, Editor editor, PsiFile file) {
- PossiblePrefixReference ref = getReference(file, editor);
- return ref != null && ref.resolve() instanceof SchemaPrefix;
- }
-
@Nullable
private static PossiblePrefixReference getReference(PsiFile file, Editor editor) {
if (file != null && editor != null) {
@@ -55,6 +48,12 @@ public class SchemaPrefixRenameHandler extends VariableInplaceRenameHandler {
}
@Override
+ protected boolean isAvailable(PsiElement element, Editor editor, PsiFile file) {
+ PossiblePrefixReference ref = getReference(file, editor);
+ return ref != null && ref.resolve() instanceof SchemaPrefix;
+ }
+
+ @Override
protected VariableInplaceRenamer createRenamer(@NotNull PsiElement elementToRename, Editor editor) {
PossiblePrefixReference reference = getReference(elementToRename.getContainingFile(), editor);
if (reference != null) {
@@ -71,12 +70,6 @@ public class SchemaPrefixRenameHandler extends VariableInplaceRenameHandler {
};
}
}
- if (ApplicationManager.getApplication().isUnitTestMode()) {
- System.out.println("Reference: " + reference);
- if (reference != null) {
- System.out.println("Resolved: " + reference.resolve());
- }
- }
return null;
}
}
diff --git a/xml/impl/src/com/intellij/xml/refactoring/XmlInlineHandler.java b/xml/impl/src/com/intellij/xml/refactoring/XmlInlineHandler.java
index bd3b6b0c8c80..865805796322 100644
--- a/xml/impl/src/com/intellij/xml/refactoring/XmlInlineHandler.java
+++ b/xml/impl/src/com/intellij/xml/refactoring/XmlInlineHandler.java
@@ -3,22 +3,23 @@ package com.intellij.xml.refactoring;
import com.intellij.lang.refactoring.InlineHandler;
import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
/**
* @author Eugene.Kudelevsky
*/
public class XmlInlineHandler implements InlineHandler {
@Override
- public Settings prepareInlineElement(PsiElement element, Editor editor, boolean invokedOnReference) {
+ public Settings prepareInlineElement(@NotNull PsiElement element, Editor editor, boolean invokedOnReference) {
return null;
}
@Override
- public void removeDefinition(PsiElement element, Settings settings) {
+ public void removeDefinition(@NotNull PsiElement element, @NotNull Settings settings) {
}
@Override
- public Inliner createInliner(PsiElement element, Settings settings) {
+ public Inliner createInliner(@NotNull PsiElement element, @NotNull Settings settings) {
return null;
}
}
diff --git a/xml/impl/src/org/jetbrains/io/fastCgi/FastCgiChannelHandler.java b/xml/impl/src/org/jetbrains/io/fastCgi/FastCgiChannelHandler.java
index d24078221b30..4a83b637500e 100644
--- a/xml/impl/src/org/jetbrains/io/fastCgi/FastCgiChannelHandler.java
+++ b/xml/impl/src/org/jetbrains/io/fastCgi/FastCgiChannelHandler.java
@@ -92,7 +92,14 @@ public class FastCgiChannelHandler extends SimpleChannelInboundHandlerAdapter<Fa
String value = builder.toString();
if (key.equalsIgnoreCase("status")) {
- response.setStatus(HttpResponseStatus.valueOf(Integer.parseInt(value.substring(0, value.indexOf(' ')))));
+ int index = value.indexOf(' ');
+ if (index == -1) {
+ LOG.warn("Cannot parse status: " + value);
+ response.setStatus(HttpResponseStatus.OK);
+ }
+ else {
+ response.setStatus(HttpResponseStatus.valueOf(Integer.parseInt(value.substring(0, index))));
+ }
}
else if (!(key.startsWith("http") || key.startsWith("HTTP"))) {
response.headers().add(key, value);