mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't optimize groovy imports when the user is editing them manually
This commit is contained in:
+8
@@ -70,6 +70,14 @@ public class GroovyUnusedImportPass extends TextEditorHighlightingPass {
|
||||
if (!myUnusedImports.isEmpty() && CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY) {
|
||||
final VirtualFile vfile = myFile.getVirtualFile();
|
||||
if (vfile != null && ProjectRootManager.getInstance(myFile.getProject()).getFileIndex().isInSource(vfile)) {
|
||||
final GrImportStatement[] imports = myFile.getImportStatements();
|
||||
if (imports.length > 0) {
|
||||
final int offset = myEditor.getCaretModel().getOffset();
|
||||
if (imports[0].getTextRange().getStartOffset() <= offset && offset <= imports[imports.length - 1].getTextRange().getEndOffset()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
myOptimizeRunnable = new GroovyImportOptimizer().processFile(myFile);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user