mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
code cleanup action should take toplevel file instead of injected one (IDEA-202177)
This commit is contained in:
+2
-1
@@ -23,6 +23,7 @@ import com.intellij.codeInsight.intention.LowPriorityAction;
|
||||
import com.intellij.codeInspection.InspectionManager;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.ex.GlobalInspectionContextBase;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
@@ -52,7 +53,7 @@ public abstract class CleanupIntention implements IntentionAction, LowPriorityAc
|
||||
if (!FileModificationService.getInstance().preparePsiElementForWrite(file)) return;
|
||||
final InspectionManager managerEx = InspectionManager.getInstance(project);
|
||||
final GlobalInspectionContextBase globalContext = (GlobalInspectionContextBase)managerEx.createNewGlobalContext(false);
|
||||
final AnalysisScope scope = getScope(project, file);
|
||||
final AnalysisScope scope = getScope(project, InjectedLanguageManager.getInstance(project).getTopLevelFile(file));
|
||||
if (scope != null) {
|
||||
globalContext.codeCleanup(scope, InspectionProjectProfileManager.getInstance(project).getCurrentProfile(), getText(), null, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user