IDEA-119253 Option to turn off auto-complete for HTML

This commit is contained in:
Dmitry Avdeev
2014-09-08 19:09:42 +04:00
parent 23d0358941
commit ff8ff05ff6
4 changed files with 47 additions and 23 deletions
@@ -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>
@@ -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
@@ -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();
@@ -44,6 +44,7 @@ public class WebEditorOptions implements PersistentStateComponent<WebEditorOptio
private boolean myAutomaticallyInsertClosingTag = true;
private boolean myAutomaticallyInsertRequiredAttributes = true;
private boolean myAutomaticallyInsertRequiredSubTags = true;
private boolean myAutoCloseTag = true;
private boolean myAutomaticallyStartAttribute = true;
private boolean myInsertQuotesForAttributeValue = true;
@@ -51,30 +52,30 @@ public class WebEditorOptions implements PersistentStateComponent<WebEditorOptio
private int myTagTreeHighlightingLevelCount = 6;
private int myTagTreeHighlightingOpacity = 10;
public static WebEditorOptions getInstance() {
return ServiceManager.getService(WebEditorOptions.class);
}
public WebEditorOptions() {
setTagTreeHighlightingEnabled(!ApplicationManager.getApplication().isUnitTestMode());
}
public void setBreadcrumbsEnabled(boolean b) {
myBreadcrumbsEnabled = b;
public static WebEditorOptions getInstance() {
return ServiceManager.getService(WebEditorOptions.class);
}
public boolean isBreadcrumbsEnabled() {
return myBreadcrumbsEnabled;
}
public void setBreadcrumbsEnabledInXml(boolean b) {
myBreadcrumbsEnabledInXml = b;
public void setBreadcrumbsEnabled(boolean b) {
myBreadcrumbsEnabled = b;
}
public boolean isBreadcrumbsEnabledInXml() {
return myBreadcrumbsEnabledInXml;
}
public void setBreadcrumbsEnabledInXml(boolean b) {
myBreadcrumbsEnabledInXml = b;
}
public boolean isShowCssInlineColorPreview() {
return myShowCssInlineColorPreview;
}
@@ -121,30 +122,30 @@ public class WebEditorOptions implements PersistentStateComponent<WebEditorOptio
myAutomaticallyInsertRequiredSubTags = automaticallyInsertRequiredSubTags;
}
public void setTagTreeHighlightingLevelCount(int tagTreeHighlightingLevelCount) {
myTagTreeHighlightingLevelCount = tagTreeHighlightingLevelCount;
}
public int getTagTreeHighlightingLevelCount() {
return myTagTreeHighlightingLevelCount;
}
public void setTagTreeHighlightingOpacity(int tagTreeHighlightingOpacity) {
myTagTreeHighlightingOpacity = tagTreeHighlightingOpacity;
public void setTagTreeHighlightingLevelCount(int tagTreeHighlightingLevelCount) {
myTagTreeHighlightingLevelCount = tagTreeHighlightingLevelCount;
}
public int getTagTreeHighlightingOpacity() {
return myTagTreeHighlightingOpacity;
}
public void setTagTreeHighlightingEnabled(boolean tagTreeHighlightingEnabled) {
myTagTreeHighlightingEnabled = tagTreeHighlightingEnabled;
public void setTagTreeHighlightingOpacity(int tagTreeHighlightingOpacity) {
myTagTreeHighlightingOpacity = tagTreeHighlightingOpacity;
}
public boolean isTagTreeHighlightingEnabled() {
return myTagTreeHighlightingEnabled;
}
public void setTagTreeHighlightingEnabled(boolean tagTreeHighlightingEnabled) {
myTagTreeHighlightingEnabled = tagTreeHighlightingEnabled;
}
@Override
@NotNull
public File[] getExportFiles() {
@@ -193,4 +194,12 @@ public class WebEditorOptions implements PersistentStateComponent<WebEditorOptio
public void setInsertQuotesForAttributeValue(boolean insertQuotesForAttributeValue) {
myInsertQuotesForAttributeValue = insertQuotesForAttributeValue;
}
public boolean isAutoCloseTag() {
return myAutoCloseTag;
}
public void setAutoCloseTag(boolean autoCloseTag) {
myAutoCloseTag = autoCloseTag;
}
}