From ff8ff05ff65aec62a0c5872608fc1f96de20b292 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Mon, 8 Sep 2014 19:08:03 +0400 Subject: [PATCH] IDEA-119253 Option to turn off auto-complete for HTML --- .../options/editor/WebEditorOptionsForm.form | 21 +++++++--- .../editor/WebEditorOptionsProvider.java | 6 ++- .../editorActions/XmlSlashTypedHandler.java | 2 + .../options/editor/WebEditorOptions.java | 41 +++++++++++-------- 4 files changed, 47 insertions(+), 23 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 @@ - + @@ -24,7 +24,7 @@ - + @@ -32,7 +32,7 @@ - + @@ -41,7 +41,7 @@ - + @@ -49,7 +49,7 @@ - + @@ -57,7 +57,16 @@ - + + + + + + + + + + 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/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/xml-analysis-impl/src/com/intellij/application/options/editor/WebEditorOptions.java b/xml/xml-analysis-impl/src/com/intellij/application/options/editor/WebEditorOptions.java index c658068ae88e..a5222d701c35 100644 --- a/xml/xml-analysis-impl/src/com/intellij/application/options/editor/WebEditorOptions.java +++ b/xml/xml-analysis-impl/src/com/intellij/application/options/editor/WebEditorOptions.java @@ -44,6 +44,7 @@ public class WebEditorOptions implements PersistentStateComponent