mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[InlayParameterHints] Move option to Editor | Appearance, enable by default
This commit is contained in:
+5
-5
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
import com.intellij.codeInsight.folding.JavaCodeFoldingSettings;
|
||||
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
|
||||
import com.intellij.openapi.util.Couple;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
@@ -46,9 +46,9 @@ public class ParameterNameHintsManager {
|
||||
PsiExpression[] callArguments = getArguments(callExpression);
|
||||
JavaResolveResult resolveResult = callExpression.resolveMethodGenerics();
|
||||
|
||||
JavaCodeFoldingSettings settings = JavaCodeFoldingSettings.getInstance();
|
||||
EditorSettingsExternalizable settings = EditorSettingsExternalizable.getInstance();
|
||||
List<InlayInfo> descriptors = Collections.emptyList();
|
||||
if (callArguments.length >= settings.getInlineLiteralParameterMinArgumentsToFold() &&
|
||||
if (callArguments.length >= settings.getMinArgsToShow() &&
|
||||
hasLiteralExpression(callArguments) &&
|
||||
resolveResult.getElement() instanceof PsiMethod) {
|
||||
PsiMethod method = (PsiMethod)resolveResult.getElement();
|
||||
@@ -159,8 +159,8 @@ public class ParameterNameHintsManager {
|
||||
}
|
||||
|
||||
private static boolean hasProperLength(@Nullable String paramName) {
|
||||
JavaCodeFoldingSettings settings = JavaCodeFoldingSettings.getInstance();
|
||||
return paramName != null && paramName.length() >= settings.getInlineLiteralParameterMinNameLength();
|
||||
final int minLength = EditorSettingsExternalizable.getInstance().getMinParamNameLengthToShow();
|
||||
return paramName != null && paramName.length() >= minLength;
|
||||
}
|
||||
|
||||
private static boolean hasLiteralInVarargs(int index, PsiExpression[] callArguments) {
|
||||
|
||||
+1
-22
@@ -28,28 +28,7 @@ public class JavaCodeFoldingOptionsProvider extends BeanConfigurable<JavaCodeFol
|
||||
public JavaCodeFoldingOptionsProvider() {
|
||||
super(JavaCodeFoldingSettings.getInstance());
|
||||
JavaCodeFoldingSettings settings = getInstance();
|
||||
checkBox(ApplicationBundle.message("checkbox.collapse.boolean.parameters"), settings::isInlineParameterNamesForLiteralCallArguments, settings::setInlineParameterNamesForLiteralCallArguments);
|
||||
JavaCodeFoldingSettingsPanel panel = new JavaCodeFoldingSettingsPanel();
|
||||
|
||||
component(panel.getRow0(),
|
||||
() -> null,
|
||||
pair -> {},
|
||||
() -> null,
|
||||
pair -> {}
|
||||
);
|
||||
component(panel.getRow1(),
|
||||
settings::getInlineLiteralParameterMinNameLength,
|
||||
settings::setInlineLiteralParameterMinNameLength,
|
||||
panel::getMinNameLengthThresholdText,
|
||||
panel::setMinNameLengthThresholdText
|
||||
);
|
||||
component(panel.getRow2(),
|
||||
settings::getInlineLiteralParameterMinArgumentsToFold,
|
||||
settings::setInlineLiteralParameterMinArgumentsToFold,
|
||||
panel::getMinArgumentsToFoldText,
|
||||
panel::setMinArgumentsToFoldText
|
||||
);
|
||||
|
||||
|
||||
checkBox(ApplicationBundle.message("checkbox.collapse.one.line.methods"), settings::isCollapseOneLineMethods, settings::setCollapseOneLineMethods);
|
||||
|
||||
checkBox(ApplicationBundle.message("checkbox.collapse.simple.property.accessors"), settings::isCollapseAccessors, settings::setCollapseAccessors);
|
||||
|
||||
-83
@@ -1,83 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.editor.JavaCodeFoldingSettingsPanel">
|
||||
<grid id="27dc6" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="852" height="97"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="bc2a4" binding="row1" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="a067a" class="javax.swing.JTextField" binding="minNameLengthThresholdText">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="2746f" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="5" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Minimum Parameter Name Length:"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="8e464" binding="row2" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="11578" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="5" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Minimum Number of Arguments To Fold:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="dc29a" class="javax.swing.JTextField" binding="minArgumentsToFoldText">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="72ed7" binding="row0" layout-manager="GridLayoutManager" row-count="1" 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="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="c0ee0" class="com.intellij.ui.TitledSeparator">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="1" indent="3" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Literal Arguments Options"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
-64
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.application.options.editor;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class JavaCodeFoldingSettingsPanel {
|
||||
private JTextField minNameLengthThresholdText;
|
||||
private JTextField minArgumentsToFoldText;
|
||||
private JPanel row0;
|
||||
private JPanel row1;
|
||||
private JPanel row2;
|
||||
|
||||
int getMinNameLengthThresholdText() {
|
||||
try {
|
||||
return Integer.parseInt(minNameLengthThresholdText.getText());
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
void setMinNameLengthThresholdText(int value) {
|
||||
minNameLengthThresholdText.setText(String.valueOf(value));
|
||||
}
|
||||
|
||||
int getMinArgumentsToFoldText() {
|
||||
try {
|
||||
return Integer.parseInt(minArgumentsToFoldText.getText());
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
void setMinArgumentsToFoldText(int value) {
|
||||
minArgumentsToFoldText.setText(String.valueOf(value));
|
||||
}
|
||||
|
||||
JComponent getRow0() {
|
||||
return row0;
|
||||
}
|
||||
|
||||
JPanel getRow1() {
|
||||
return row1;
|
||||
}
|
||||
|
||||
JPanel getRow2() {
|
||||
return row2;
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -19,15 +19,14 @@ import com.intellij.codeHighlighting.EditorBoundHighlightingPass;
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPass;
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPassFactory;
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPassRegistrar;
|
||||
import com.intellij.codeInsight.folding.JavaCodeFoldingSettings;
|
||||
import com.intellij.openapi.components.AbstractProjectComponent;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.Inlay;
|
||||
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressIndicatorProvider;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -74,7 +73,7 @@ public class ParameterHintsPassFactory extends AbstractProjectComponent implemen
|
||||
}
|
||||
|
||||
private static boolean isEnabled() {
|
||||
return Registry.is("editor.inline.parameter.hints") || JavaCodeFoldingSettings.getInstance().isInlineParameterNamesForLiteralCallArguments();
|
||||
return EditorSettingsExternalizable.getInstance().isShowParameterNameHints();
|
||||
}
|
||||
|
||||
private void addElementsToFold(PsiClass aClass) {
|
||||
|
||||
@@ -65,13 +65,4 @@ public abstract class JavaCodeFoldingSettings {
|
||||
|
||||
public abstract boolean isCollapseEndOfLineComments();
|
||||
public abstract void setCollapseEndOfLineComments(boolean value);
|
||||
|
||||
public abstract boolean isInlineParameterNamesForLiteralCallArguments();
|
||||
public abstract void setInlineParameterNamesForLiteralCallArguments(boolean value);
|
||||
|
||||
public abstract int getInlineLiteralParameterMinNameLength();
|
||||
public abstract void setInlineLiteralParameterMinNameLength(int value);
|
||||
|
||||
public abstract int getInlineLiteralParameterMinArgumentsToFold();
|
||||
public abstract void setInlineLiteralParameterMinArgumentsToFold(int value);
|
||||
}
|
||||
|
||||
-33
@@ -29,9 +29,6 @@ public class JavaCodeFoldingSettingsBase extends JavaCodeFoldingSettings {
|
||||
private boolean COLLAPSE_I18N_MESSAGES = true;
|
||||
private boolean COLLAPSE_SUPPRESS_WARNINGS = true;
|
||||
private boolean COLLAPSE_END_OF_LINE_COMMENTS;
|
||||
private boolean INLINE_PARAMETER_NAMES_FOR_LITERAL_CALL_ARGUMENTS;
|
||||
private int INLINE_LITERAL_PARAMETER_MIN_NAME_LENGTH = 3;
|
||||
private int INLINE_LITERAL_PARAMETER_MIN_ARGS_TO_FOLD = 2;
|
||||
|
||||
@Override
|
||||
public boolean isCollapseImports() {
|
||||
@@ -171,34 +168,4 @@ public class JavaCodeFoldingSettingsBase extends JavaCodeFoldingSettings {
|
||||
public void setCollapseEndOfLineComments(boolean value) {
|
||||
COLLAPSE_END_OF_LINE_COMMENTS = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInlineParameterNamesForLiteralCallArguments() {
|
||||
return INLINE_PARAMETER_NAMES_FOR_LITERAL_CALL_ARGUMENTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInlineParameterNamesForLiteralCallArguments(boolean value) {
|
||||
INLINE_PARAMETER_NAMES_FOR_LITERAL_CALL_ARGUMENTS = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInlineLiteralParameterMinNameLength() {
|
||||
return INLINE_LITERAL_PARAMETER_MIN_NAME_LENGTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInlineLiteralParameterMinNameLength(int value) {
|
||||
INLINE_LITERAL_PARAMETER_MIN_NAME_LENGTH = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInlineLiteralParameterMinArgumentsToFold() {
|
||||
return INLINE_LITERAL_PARAMETER_MIN_ARGS_TO_FOLD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInlineLiteralParameterMinArgumentsToFold(int value) {
|
||||
INLINE_LITERAL_PARAMETER_MIN_ARGS_TO_FOLD = value;
|
||||
}
|
||||
}
|
||||
|
||||
+23
-24
@@ -16,11 +16,9 @@
|
||||
package com.intellij.codeInsight.daemon.inlays
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.ParameterHintsPresentationManager
|
||||
import com.intellij.codeInsight.folding.JavaCodeFoldingSettings
|
||||
import com.intellij.codeInsight.folding.impl.JavaCodeFoldingSettingsImpl
|
||||
import com.intellij.openapi.editor.Inlay
|
||||
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import com.intellij.util.DocumentUtil
|
||||
@@ -29,24 +27,27 @@ import org.assertj.core.api.Assertions.assertThat
|
||||
|
||||
class InlayParameterHintsTest: LightCodeInsightFixtureTestCase() {
|
||||
|
||||
lateinit var registryStateBefore: String
|
||||
lateinit var myFoldingSettings: JavaCodeFoldingSettingsImpl
|
||||
lateinit var myFoldingStateToRestore: JavaCodeFoldingSettingsImpl
|
||||
|
||||
private var isParamHintsEnabledBefore = false
|
||||
private var minParamLength = 3
|
||||
private var minArgsToShow = 2
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
val registry = Registry.get("editor.inline.parameter.hints")
|
||||
registryStateBefore = registry.asString()
|
||||
registry.setValue(true)
|
||||
|
||||
myFoldingSettings = JavaCodeFoldingSettings.getInstance() as JavaCodeFoldingSettingsImpl
|
||||
myFoldingStateToRestore = JavaCodeFoldingSettingsImpl()
|
||||
myFoldingStateToRestore.loadState(myFoldingSettings)
|
||||
val settings = EditorSettingsExternalizable.getInstance()
|
||||
isParamHintsEnabledBefore = settings.isShowParameterNameHints
|
||||
minParamLength = settings.minParamNameLengthToShow
|
||||
minArgsToShow = settings.minArgsToShow
|
||||
|
||||
settings.isShowParameterNameHints = true
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
Registry.get("editor.inline.parameter.hints").setValue(registryStateBefore)
|
||||
myFoldingSettings.loadState(myFoldingStateToRestore)
|
||||
val settings = EditorSettingsExternalizable.getInstance()
|
||||
settings.isShowParameterNameHints = isParamHintsEnabledBefore
|
||||
settings.minParamNameLengthToShow = minParamLength
|
||||
settings.minArgsToShow = minArgsToShow
|
||||
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
@@ -259,11 +260,10 @@ public class CharSymbol {
|
||||
}
|
||||
|
||||
fun `test inline literal arguments with crazy settings`() {
|
||||
val foldingSettings = JavaCodeFoldingSettings.getInstance()
|
||||
foldingSettings.isInlineParameterNamesForLiteralCallArguments = true;
|
||||
foldingSettings.inlineLiteralParameterMinArgumentsToFold = 1;
|
||||
foldingSettings.inlineLiteralParameterMinNameLength = 1;
|
||||
|
||||
val settings = EditorSettingsExternalizable.getInstance()
|
||||
settings.minArgsToShow = 1
|
||||
settings.minParamNameLengthToShow = 1
|
||||
|
||||
setup("""
|
||||
public class Test {
|
||||
public void main(boolean isActive, boolean requestFocus, int xoo) {
|
||||
@@ -281,10 +281,9 @@ public class Test {
|
||||
}
|
||||
|
||||
fun `test hints for generic arguments`() {
|
||||
val foldingSettings = JavaCodeFoldingSettings.getInstance()
|
||||
foldingSettings.isInlineParameterNamesForLiteralCallArguments = true
|
||||
foldingSettings.inlineLiteralParameterMinArgumentsToFold = 1
|
||||
foldingSettings.inlineLiteralParameterMinNameLength = 1
|
||||
val settings = EditorSettingsExternalizable.getInstance()
|
||||
settings.minArgsToShow = 1
|
||||
settings.minParamNameLengthToShow = 1
|
||||
|
||||
setup("""
|
||||
import java.util.*;
|
||||
|
||||
+61
-16
@@ -1,21 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.editor.EditorAppearanceConfigurable">
|
||||
<grid id="27dc6" binding="myRootPanel" layout-manager="GridLayoutManager" row-count="14" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
|
||||
<grid id="27dc6" binding="myRootPanel" layout-manager="GridLayoutManager" row-count="17" column-count="21" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="451"/>
|
||||
<xy x="20" y="20" width="707" height="451"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<vspacer id="f3f11">
|
||||
<constraints>
|
||||
<grid row="13" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="16" column="0" row-span="1" col-span="21" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="2eb36" class="javax.swing.JCheckBox" binding="myCbBlockCursor">
|
||||
<constraints>
|
||||
<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"/>
|
||||
<grid row="1" column="0" row-span="1" col-span="21" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/ApplicationBundle" key="checkbox.use.block.caret"/>
|
||||
@@ -23,7 +23,7 @@
|
||||
</component>
|
||||
<component id="357c7" class="javax.swing.JCheckBox" binding="myCbRightMargin">
|
||||
<constraints>
|
||||
<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"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="21" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="false"/>
|
||||
@@ -32,7 +32,7 @@
|
||||
</component>
|
||||
<component id="6a414" class="javax.swing.JCheckBox" binding="myCbShowLineNumbers">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="3" column="0" row-span="1" col-span="21" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/ApplicationBundle" key="checkbox.show.line.numbers"/>
|
||||
@@ -40,7 +40,7 @@
|
||||
</component>
|
||||
<component id="2ee6" class="javax.swing.JCheckBox" binding="myCbShowWhitespaces">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="5" column="0" row-span="1" col-span="21" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/ApplicationBundle" key="checkbox.show.whitespaces"/>
|
||||
@@ -48,7 +48,7 @@
|
||||
</component>
|
||||
<component id="c1be5" class="javax.swing.JCheckBox" binding="myLeadingWhitespacesCheckBox">
|
||||
<constraints>
|
||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
<grid row="6" column="0" row-span="1" col-span="21" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<enabled value="false"/>
|
||||
@@ -58,7 +58,7 @@
|
||||
</component>
|
||||
<component id="2cb48" class="javax.swing.JCheckBox" binding="myInnerWhitespacesCheckBox">
|
||||
<constraints>
|
||||
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
<grid row="7" column="0" row-span="1" col-span="21" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<enabled value="false"/>
|
||||
@@ -68,7 +68,7 @@
|
||||
</component>
|
||||
<component id="e4e67" class="javax.swing.JCheckBox" binding="myTrailingWhitespacesCheckBox">
|
||||
<constraints>
|
||||
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
<grid row="8" column="0" row-span="1" col-span="21" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<enabled value="false"/>
|
||||
@@ -78,7 +78,7 @@
|
||||
</component>
|
||||
<component id="d097a" class="javax.swing.JCheckBox" binding="myShowVerticalIndentGuidesCheckBox" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="9" column="0" row-span="1" col-span="21" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Show vertical indent guides"/>
|
||||
@@ -86,7 +86,7 @@
|
||||
</component>
|
||||
<grid id="7b00c" binding="myAddonPanel" layout-manager="GridBagLayout">
|
||||
<constraints>
|
||||
<grid row="12" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="15" column="0" row-span="1" col-span="15" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -94,7 +94,7 @@
|
||||
</grid>
|
||||
<component id="4c9d9" class="javax.swing.JCheckBox" binding="myCbShowMethodSeparators">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="4" column="0" row-span="1" col-span="21" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/ApplicationBundle" key="checkbox.show.method.separators"/>
|
||||
@@ -103,7 +103,7 @@
|
||||
<grid id="47613" layout-manager="GridLayoutManager" row-count="1" column-count="2" 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="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="21" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -132,7 +132,9 @@
|
||||
</grid>
|
||||
<component id="b7193" class="javax.swing.JCheckBox" binding="myShowCodeLensInEditorCheckBox">
|
||||
<constraints>
|
||||
<grid row="10" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="10" column="0" row-span="1" col-span="21" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="251" height="19"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/IdeBundle" key="checkbox.show.editor.preview.popup"/>
|
||||
@@ -140,12 +142,55 @@
|
||||
</component>
|
||||
<component id="6c585" class="javax.swing.JCheckBox" binding="myShowBreadcrumbsCheckBox">
|
||||
<constraints>
|
||||
<grid row="11" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="11" column="0" row-span="1" col-span="21" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/ApplicationBundle" key="checkbox.show.breadcrumbs"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="b82cd" class="com.intellij.ui.components.JBCheckBox" binding="myShowParameterNameHints">
|
||||
<constraints>
|
||||
<grid row="12" column="0" row-span="1" col-span="21" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Show parameter name hints"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="d1619" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="13" column="0" row-span="1" col-span="4" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="5" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<labelFor value="78a74"/>
|
||||
<text value="Minimum parameter name length to show:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="85b58" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="14" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="5" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Minimum arguments to show:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="78a74" class="javax.swing.JSpinner" binding="myMinimumParameterNameLengthToShow">
|
||||
<constraints>
|
||||
<grid row="13" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="50" height="-1"/>
|
||||
<maximum-size width="50" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="f4703" class="javax.swing.JSpinner" binding="myMinimumArgumentsToShow">
|
||||
<constraints>
|
||||
<grid row="14" column="4" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="50" height="-1"/>
|
||||
<maximum-size width="50" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
+42
-15
@@ -26,13 +26,12 @@ import com.intellij.openapi.options.CompositeConfigurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.UnnamedConfigurable;
|
||||
import com.intellij.openapi.options.ex.ConfigurableWrapper;
|
||||
import com.intellij.ui.components.JBCheckBox;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -64,6 +63,9 @@ public class EditorAppearanceConfigurable extends CompositeConfigurable<UnnamedC
|
||||
private JCheckBox myShowCodeLensInEditorCheckBox;
|
||||
private JCheckBox myShowVerticalIndentGuidesCheckBox;
|
||||
private JCheckBox myShowBreadcrumbsCheckBox;
|
||||
private JBCheckBox myShowParameterNameHints;
|
||||
private JSpinner myMinimumParameterNameLengthToShow;
|
||||
private JSpinner myMinimumArgumentsToShow;
|
||||
//private JCheckBox myUseLCDRendering;
|
||||
|
||||
public EditorAppearanceConfigurable() {
|
||||
@@ -73,20 +75,34 @@ public class EditorAppearanceConfigurable extends CompositeConfigurable<UnnamedC
|
||||
// myUseLCDRendering.setEnabled(myAntialiasingInEditorCheckBox.isSelected());
|
||||
// }
|
||||
//});
|
||||
myCbBlinkCaret.addActionListener(
|
||||
new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
myBlinkIntervalField.setEnabled(myCbBlinkCaret.isSelected());
|
||||
}
|
||||
|
||||
myCbBlinkCaret.addActionListener((e) -> myBlinkIntervalField.setEnabled(myCbBlinkCaret.isSelected()));
|
||||
myCbShowWhitespaces.addActionListener((e) -> updateWhitespaceCheckboxesState());
|
||||
myShowParameterNameHints.addActionListener((e) -> resetNameHintsSettings());
|
||||
}
|
||||
|
||||
private void resetNameHintsSettings() {
|
||||
boolean isSelected = myShowParameterNameHints.isSelected();
|
||||
myMinimumArgumentsToShow.setEnabled(isSelected);
|
||||
myMinimumParameterNameLengthToShow.setEnabled(isSelected);
|
||||
|
||||
EditorSettingsExternalizable settings = EditorSettingsExternalizable.getInstance();
|
||||
final int currentParamLength = settings.getMinParamNameLengthToShow();
|
||||
final int minArguments = settings.getMinArgsToShow();
|
||||
|
||||
myMinimumParameterNameLengthToShow.setModel(new SpinnerNumberModel(currentParamLength, 1, Integer.MAX_VALUE, 1));
|
||||
myMinimumArgumentsToShow.setModel(new SpinnerNumberModel(minArguments, 1, Integer.MAX_VALUE, 1));
|
||||
}
|
||||
|
||||
private void applyNameHintsSettings() {
|
||||
boolean isSelected = myShowParameterNameHints.isSelected();
|
||||
EditorSettingsExternalizable settings = EditorSettingsExternalizable.getInstance();
|
||||
|
||||
settings.setShowParameterNameHints(isSelected);
|
||||
if (isSelected) {
|
||||
settings.setMinParamNameLengthToShow((int)myMinimumParameterNameLengthToShow.getModel().getValue());
|
||||
settings.setMinArgsToShow((int)myMinimumArgumentsToShow.getModel().getValue());
|
||||
}
|
||||
);
|
||||
myCbShowWhitespaces.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updateWhitespaceCheckboxesState();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateWhitespaceCheckboxesState() {
|
||||
@@ -119,6 +135,9 @@ public class EditorAppearanceConfigurable extends CompositeConfigurable<UnnamedC
|
||||
|
||||
updateWhitespaceCheckboxesState();
|
||||
|
||||
myShowParameterNameHints.setSelected(editorSettings.isShowParameterNameHints());
|
||||
resetNameHintsSettings();
|
||||
|
||||
super.reset();
|
||||
}
|
||||
|
||||
@@ -177,6 +196,7 @@ public class EditorAppearanceConfigurable extends CompositeConfigurable<UnnamedC
|
||||
}
|
||||
EditorOptionsPanel.restartDaemons();
|
||||
|
||||
applyNameHintsSettings();
|
||||
super.apply();
|
||||
}
|
||||
|
||||
@@ -202,6 +222,13 @@ public class EditorAppearanceConfigurable extends CompositeConfigurable<UnnamedC
|
||||
//isModified |= myUseLCDRendering.isSelected() != UISettings.getInstance().USE_LCD_RENDERING_IN_EDITOR;
|
||||
isModified |= myShowCodeLensInEditorCheckBox.isSelected() != UISettings.getInstance().SHOW_EDITOR_TOOLTIP;
|
||||
isModified |= myShowBreadcrumbsCheckBox.isSelected() != editorSettings.isBreadcrumbsShown();
|
||||
isModified |= myShowParameterNameHints.isSelected() != editorSettings.isShowParameterNameHints();
|
||||
|
||||
if (myShowParameterNameHints.isSelected()) {
|
||||
isModified |= (int)myMinimumParameterNameLengthToShow.getModel().getValue() != editorSettings.getMinParamNameLengthToShow();
|
||||
isModified |= (int)myMinimumArgumentsToShow.getModel().getValue() != editorSettings.getMinArgsToShow();
|
||||
}
|
||||
|
||||
|
||||
return isModified;
|
||||
}
|
||||
|
||||
+3
@@ -77,6 +77,9 @@ class EditorSettingsStatisticsCollector extends UsagesCollector {
|
||||
addIfDiffers(set, es.getOptions().SHOW_NOTIFICATION_AFTER_OPTIMIZE_IMPORTS_ACTION, true, "afterOptimizeNotification");
|
||||
addIfDiffers(set, es.isSmartHome(), true, "smartHome");
|
||||
addIfDiffers(set, es.isCamelWords(), false, "camelWords");
|
||||
addIfDiffers(set, es.isShowParameterNameHints(), true, "editor.inlay.parameter.hints");
|
||||
addIfDiffers(set, es.getMinArgsToShow(), 2, "editor.inlay.parameter.hints.min.args");
|
||||
addIfDiffers(set, es.getMinParamNameLengthToShow(), 3, "editor.inlay.parameter.hints.min.param.length");
|
||||
|
||||
RichCopySettings rcs = RichCopySettings.getInstance();
|
||||
addIfDiffers(set, rcs.isEnabled(), true, "richCopy");
|
||||
|
||||
+29
@@ -86,6 +86,10 @@ public class EditorSettingsExternalizable implements PersistentStateComponent<Ed
|
||||
public boolean ADD_CARETS_ON_DOUBLE_CTRL = true;
|
||||
|
||||
public BidiTextDirection BIDI_TEXT_DIRECTION = BidiTextDirection.CONTENT_BASED;
|
||||
|
||||
public boolean SHOW_PARAMETER_NAME_HINTS = true;
|
||||
public int MIN_PARAM_NAME_LENGTH_TO_SHOW = 3;
|
||||
public int MIN_PARAMS_TO_SHOW = 2;
|
||||
}
|
||||
|
||||
private static final String COMPOSITE_PROPERTY_SEPARATOR = ":";
|
||||
@@ -534,4 +538,29 @@ public class EditorSettingsExternalizable implements PersistentStateComponent<Ed
|
||||
public void setBidiTextDirection(BidiTextDirection direction) {
|
||||
myOptions.BIDI_TEXT_DIRECTION = direction;
|
||||
}
|
||||
|
||||
public boolean isShowParameterNameHints() {
|
||||
return myOptions.SHOW_PARAMETER_NAME_HINTS;
|
||||
}
|
||||
|
||||
public void setShowParameterNameHints(boolean value) {
|
||||
myOptions.SHOW_PARAMETER_NAME_HINTS = value;
|
||||
}
|
||||
|
||||
public int getMinParamNameLengthToShow() {
|
||||
return myOptions.MIN_PARAM_NAME_LENGTH_TO_SHOW;
|
||||
}
|
||||
|
||||
public void setMinParamNameLengthToShow(int value) {
|
||||
myOptions.MIN_PARAM_NAME_LENGTH_TO_SHOW = value;
|
||||
}
|
||||
|
||||
public int getMinArgsToShow() {
|
||||
return myOptions.MIN_PARAMS_TO_SHOW;
|
||||
}
|
||||
|
||||
public void setMinArgsToShow(int minParamsToShow) {
|
||||
myOptions.MIN_PARAMS_TO_SHOW = minParamsToShow;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -164,9 +164,6 @@ editor.durable.folding.state.description=If set, collapsed fold regions will pre
|
||||
editor.soft.wrap.force.limit=10000
|
||||
editor.soft.wrap.force.limit.description=If document contains lines longer than this value, soft wraps will be forcibly enabled in editor due to performance reasons
|
||||
|
||||
editor.inline.parameter.hints=false
|
||||
editor.inline.parameter.hints.description=Show inline hints with parameter names for literal method call arguments
|
||||
|
||||
editor.navigation.history.stack.size=25
|
||||
editor.navigation.history.stack.size.description=Stack size limit for back/forward and last/next edit location navigation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user