RegExp: surround rendered regex with gray slashes

GitOrigin-RevId: eb1514d8bf84e1a4c0f459a3b9bc9fdf02a0dc93
This commit is contained in:
Bas Leijdekkers
2023-01-23 16:24:28 +01:00
committed by intellij-monorepo-bot
parent 3934568cf3
commit a344209553

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.lang.regexp.inspection.custom;
import com.intellij.icons.AllIcons;
@@ -26,16 +26,17 @@ public class RegExpInspectionConfigurationCellRenderer extends ColoredListCellRe
setIcon((fileType == null) ? AllIcons.FileTypes.Any_type : fileType.getIcon());
final String regExp = value.regExp();
final String replacement = value.replacement();
append("'", SimpleTextAttributes.GRAY_ATTRIBUTES);
append("/", SimpleTextAttributes.GRAY_ATTRIBUTES);
if (replacement != null) {
append(shortenTextWithEllipsis(regExp, 49, 0, true), SimpleTextAttributes.REGULAR_ATTRIBUTES);
append("' ⇨ '", SimpleTextAttributes.GRAY_ATTRIBUTES);
append("/ ⇨ '", SimpleTextAttributes.GRAY_ATTRIBUTES);
append(shortenTextWithEllipsis(replacement, 49, 0, true), SimpleTextAttributes.REGULAR_ATTRIBUTES);
append("'", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
else {
append(shortenTextWithEllipsis(regExp, 100, 0, true), SimpleTextAttributes.REGULAR_ATTRIBUTES);
append("/", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
append("'", SimpleTextAttributes.GRAY_ATTRIBUTES);
setEnabled(list.isEnabled());
}
}