mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: add space between field/method name and type (IDEA-138681)
GitOrigin-RevId: 913bf430a86cec149e99cdad5f4f52eeaa196555
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b867759f5c
commit
ab8455f916
+3
-6
@@ -3,7 +3,6 @@ package com.intellij.ide.structureView.impl.java;
|
||||
|
||||
import com.intellij.ide.util.treeView.smartTree.SortableTreeElement;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiSubstitutor;
|
||||
import com.intellij.psi.PsiVariable;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -25,11 +24,9 @@ public abstract class JavaVariableBaseTreeElement<T extends PsiVariable> extends
|
||||
if (field == null) return "";
|
||||
|
||||
final boolean dumb = DumbService.isDumb(field.getProject());
|
||||
final String text = formatVariable(field,
|
||||
SHOW_NAME | (dumb ? 0 : SHOW_TYPE) | TYPE_AFTER | (dumb ? 0 : SHOW_INITIALIZER),
|
||||
PsiSubstitutor.EMPTY);
|
||||
final int colon = text.indexOf(':');
|
||||
return colon >= 0 ? text.substring(0, colon + 1) + ' ' + text.substring(colon + 1) : text;
|
||||
return formatVariable(field,
|
||||
SHOW_NAME | (dumb ? 0 : SHOW_TYPE) | TYPE_AFTER | (dumb ? 0 : SHOW_INITIALIZER),
|
||||
PsiSubstitutor.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-8
@@ -51,14 +51,13 @@ public class PsiMethodTreeElement extends JavaClassTreeElementBase<PsiMethod> im
|
||||
|
||||
@Override
|
||||
public String getPresentableText() {
|
||||
final PsiMethod psiMethod = getElement();
|
||||
if (psiMethod == null) return "";
|
||||
final boolean dumb = DumbService.isDumb(psiMethod.getProject());
|
||||
String method = PsiFormatUtil.formatMethod(psiMethod,
|
||||
PsiSubstitutor.EMPTY,
|
||||
SHOW_NAME | TYPE_AFTER | SHOW_PARAMETERS | (dumb ? 0 : SHOW_TYPE),
|
||||
dumb ? SHOW_NAME : SHOW_TYPE);
|
||||
return StringUtil.replace(method, ":", ": ");
|
||||
final PsiMethod method = getElement();
|
||||
if (method == null) return "";
|
||||
final boolean dumb = DumbService.isDumb(method.getProject());
|
||||
return PsiFormatUtil.formatMethod(method,
|
||||
PsiSubstitutor.EMPTY,
|
||||
SHOW_NAME | TYPE_AFTER | SHOW_PARAMETERS | (dumb ? 0 : SHOW_TYPE),
|
||||
dumb ? SHOW_NAME : SHOW_TYPE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user