mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
[java] IDEA-355024 try not to propose suggestion in dumb mode
GitOrigin-RevId: dca5096fb7079ef4623f100fb0e7c0ab37eb2df4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
56773a418e
commit
46c1a5c6e9
@@ -1,6 +1,7 @@
|
|||||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||||
package com.intellij.java.refactoring.suggested
|
package com.intellij.java.refactoring.suggested
|
||||||
|
|
||||||
|
import com.intellij.openapi.project.DumbService
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import com.intellij.psi.*
|
import com.intellij.psi.*
|
||||||
import com.intellij.refactoring.suggested.SuggestedRefactoringState
|
import com.intellij.refactoring.suggested.SuggestedRefactoringState
|
||||||
@@ -12,6 +13,8 @@ import com.intellij.refactoring.suggested.SuggestedRefactoringSupport.Signature
|
|||||||
class JavaSuggestedRefactoringStateChanges(refactoringSupport: SuggestedRefactoringSupport) :
|
class JavaSuggestedRefactoringStateChanges(refactoringSupport: SuggestedRefactoringSupport) :
|
||||||
SuggestedRefactoringStateChanges(refactoringSupport) {
|
SuggestedRefactoringStateChanges(refactoringSupport) {
|
||||||
override fun createInitialState(anchor: PsiElement): SuggestedRefactoringState? {
|
override fun createInitialState(anchor: PsiElement): SuggestedRefactoringState? {
|
||||||
|
//todo make SuggestedRefactoringSupport dumbAware
|
||||||
|
if (DumbService.isDumb(anchor.project)) return null
|
||||||
val state = super.createInitialState(anchor) ?: return null
|
val state = super.createInitialState(anchor) ?: return null
|
||||||
if (anchor is PsiMember && isDuplicate(anchor, state.oldSignature)) return null
|
if (anchor is PsiMember && isDuplicate(anchor, state.oldSignature)) return null
|
||||||
return state
|
return state
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
package com.intellij.java.refactoring.suggested
|
package com.intellij.java.refactoring.suggested
|
||||||
|
|
||||||
import com.intellij.codeInsight.generation.OverrideImplementsAnnotationsHandler
|
import com.intellij.codeInsight.generation.OverrideImplementsAnnotationsHandler
|
||||||
|
import com.intellij.openapi.project.DumbService
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import com.intellij.openapi.util.registry.Registry
|
import com.intellij.openapi.util.registry.Registry
|
||||||
import com.intellij.psi.*
|
import com.intellij.psi.*
|
||||||
@@ -15,6 +16,9 @@ import com.siyeh.ig.psiutils.TypeUtils
|
|||||||
|
|
||||||
class JavaSuggestedRefactoringSupport : SuggestedRefactoringSupport {
|
class JavaSuggestedRefactoringSupport : SuggestedRefactoringSupport {
|
||||||
override fun isAnchor(psiElement: PsiElement): Boolean {
|
override fun isAnchor(psiElement: PsiElement): Boolean {
|
||||||
|
//todo make SuggestedRefactoringSupport dumbAware
|
||||||
|
if (DumbService.isDumb(psiElement.project)) return false
|
||||||
|
|
||||||
if (psiElement is PsiCallExpression && Registry.`is`("ide.java.refactoring.suggested.call.site")) {
|
if (psiElement is PsiCallExpression && Registry.`is`("ide.java.refactoring.suggested.call.site")) {
|
||||||
return psiElement.argumentList != null
|
return psiElement.argumentList != null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,12 @@ public final class DumbIncompleteModeUtil {
|
|||||||
|
|
||||||
public static boolean isDumbOrIncompleteMode(@NotNull PsiElement context) {
|
public static boolean isDumbOrIncompleteMode(@NotNull PsiElement context) {
|
||||||
Project project = context.getProject();
|
Project project = context.getProject();
|
||||||
|
return isDumbOrIncompleteMode(project);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isDumbOrIncompleteMode(@NotNull Project project) {
|
||||||
return (DumbService.isDumb(project) && Registry.is("lombok.dumb.mode.enabled", false)) ||
|
return (DumbService.isDumb(project) && Registry.is("lombok.dumb.mode.enabled", false)) ||
|
||||||
isIncompleteMode(context.getProject());
|
isIncompleteMode(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.intellij.openapi.application.ReadAction;
|
|||||||
import com.intellij.openapi.diagnostic.Logger;
|
import com.intellij.openapi.diagnostic.Logger;
|
||||||
import com.intellij.openapi.module.Module;
|
import com.intellij.openapi.module.Module;
|
||||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||||
|
import com.intellij.openapi.project.DumbService;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.roots.OrderEntry;
|
import com.intellij.openapi.roots.OrderEntry;
|
||||||
import com.intellij.openapi.roots.OrderEnumerator;
|
import com.intellij.openapi.roots.OrderEnumerator;
|
||||||
@@ -38,7 +39,7 @@ public final class LombokLibraryUtil {
|
|||||||
|
|
||||||
ThreadingAssertions.assertReadAccess();
|
ThreadingAssertions.assertReadAccess();
|
||||||
return JavaLibraryUtil.hasLibraryJar(project, "org.projectlombok:lombok")
|
return JavaLibraryUtil.hasLibraryJar(project, "org.projectlombok:lombok")
|
||||||
|| detectLombokJarsSlow(project);
|
|| (!DumbService.isDumb(project) && detectLombokJarsSlow(project));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasLombokClasses(@Nullable Module module) {
|
public static boolean hasLombokClasses(@Nullable Module module) {
|
||||||
|
|||||||
Reference in New Issue
Block a user