mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
remove dangerous method cleanAllHighlights poised to ruin highlighting consistency; see https://jetbrains.team/p/ij/reviews/143450
GitOrigin-RevId: f189d953eb33f503b25ce52c9e8d775423653299
This commit is contained in:
committed by
intellij-monorepo-bot
parent
86cfe58290
commit
d2bfc2652e
@@ -89,14 +89,6 @@ public abstract class DaemonCodeAnalyzerEx extends DaemonCodeAnalyzer {
|
||||
@ApiStatus.Internal
|
||||
public abstract void cleanFileLevelHighlights(int group, @NotNull PsiFile psiFile);
|
||||
|
||||
|
||||
/**
|
||||
* Do not use because manual management of highlights is dangerous and may lead to unexpected flicking/disappearing/stuck highlighters.
|
||||
* Instead, generate file-level infos in your inspection/annotator, and they will be removed automatically when outdated
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public abstract void cleanAllFileLevelHighlights(int group);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public abstract boolean hasFileLevelHighlights(int group, @NotNull PsiFile psiFile);
|
||||
|
||||
|
||||
@@ -246,14 +246,6 @@ public final class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanAllFileLevelHighlights(int group) {
|
||||
ThreadingAssertions.assertEventDispatchThread();
|
||||
for (FileEditor fileEditor : getFileEditorManager().getAllEditors()) {
|
||||
cleanFileLevelHighlights(fileEditor, group);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFileLevelHighlights(int group, @NotNull PsiFile psiFile) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
|
||||
@@ -521,7 +521,7 @@ public final class PyInterpreterInspection extends PyInspection {
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
PyUiUtil.clearFileLevelInspectionResults(project);
|
||||
PyUiUtil.clearFileLevelInspectionResults(descriptor.getPsiElement().getContainingFile());
|
||||
PyProjectSdkConfiguration.INSTANCE.setReadyToUseSdk(project, myModule, mySdk);
|
||||
}
|
||||
}
|
||||
@@ -546,7 +546,7 @@ public final class PyInterpreterInspection extends PyInspection {
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
PyUiUtil.clearFileLevelInspectionResults(project);
|
||||
PyUiUtil.clearFileLevelInspectionResults(descriptor.getPsiElement().getContainingFile());
|
||||
final Sdk newSdk = PySdkExtKt.setupAssociatedLogged(mySdk, myExistingSdks, BasePySdkExtKt.getBasePath(myModule), doAssociate);
|
||||
if (newSdk == null) {
|
||||
return;
|
||||
|
||||
@@ -404,7 +404,7 @@ public final class PyPackageRequirementsInspection extends PyInspection {
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
SideEffectGuard.checkSideEffectAllowed(SideEffectGuard.EffectType.PROJECT_MODEL);
|
||||
if (!checkAdminPermissionsAndConfigureInterpreter(project, descriptor, mySdk)) {
|
||||
PyUiUtil.clearFileLevelInspectionResults(project);
|
||||
PyUiUtil.clearFileLevelInspectionResults(descriptor.getPsiElement().getContainingFile());
|
||||
installPackages(project);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.jetbrains.python.sdk
|
||||
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
|
||||
import com.intellij.execution.ExecutionException
|
||||
import com.intellij.execution.target.*
|
||||
import com.intellij.openapi.application.*
|
||||
@@ -331,7 +332,7 @@ var Module.pythonSdk: Sdk?
|
||||
thisLogger().info("Setting PythonSDK $value to module $this")
|
||||
ModuleRootModificationUtil.setModuleSdk(this, value)
|
||||
runInEdt {
|
||||
PyUiUtil.clearFileLevelInspectionResults(project)
|
||||
DaemonCodeAnalyzer.getInstance(project).restart()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// 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.jetbrains.python.sdk.configuration
|
||||
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
|
||||
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl
|
||||
import com.intellij.ide.GeneralSettings
|
||||
import com.intellij.notification.NotificationAction
|
||||
import com.intellij.notification.NotificationGroupManager
|
||||
@@ -135,7 +137,7 @@ private class PyInterpreterInspectionSuppressor : PyInspectionExtension() {
|
||||
private var suppress = false
|
||||
|
||||
fun suppress(project: Project): Disposable? {
|
||||
PyUiUtil.clearFileLevelInspectionResults(project)
|
||||
DaemonCodeAnalyzer.getInstance(project).restart()
|
||||
return if (suppress) null else Suppressor()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.util.NlsContexts.PopupContent;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -68,7 +69,7 @@ public final class PyUiUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static void clearFileLevelInspectionResults(@NotNull Project project) {
|
||||
DaemonCodeAnalyzerEx.getInstanceEx(project).cleanAllFileLevelHighlights(Pass.LOCAL_INSPECTIONS);
|
||||
public static void clearFileLevelInspectionResults(@NotNull PsiFile file) {
|
||||
DaemonCodeAnalyzerEx.getInstanceEx(file.getProject()).cleanFileLevelHighlights(Pass.LOCAL_INSPECTIONS, file);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user