mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup unneeded explicit tailOffset management
This commit is contained in:
@@ -24,7 +24,6 @@ import com.intellij.codeInsight.lookup.LookupItem;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.RangeMarker;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
@@ -102,9 +101,6 @@ public class DefaultInsertHandler extends TemplateInsertHandler implements Clone
|
||||
}
|
||||
}
|
||||
addImportForItem(context, item);
|
||||
if (context.getTailOffset() < 0) { //hack, hack, hack. ideally the tail offset just should survive after the importing stuff
|
||||
context.setTailOffset(context.getEditor().getCaretModel().getOffset());
|
||||
}
|
||||
}
|
||||
catch(IncorrectOperationException e){
|
||||
LOG.error(e);
|
||||
@@ -224,11 +220,8 @@ public class DefaultInsertHandler extends TemplateInsertHandler implements Clone
|
||||
int length = lookupString.length();
|
||||
final int i = lookupString.indexOf('<');
|
||||
if (i >= 0) length = i;
|
||||
RangeMarker savedTail = context.getDocument().createRangeMarker(context.getTailOffset(), context.getTailOffset());
|
||||
final int newOffset = addImportForClass(file, startOffset, startOffset + length, aClass);
|
||||
JavaCompletionUtil.shortenReference(file, newOffset);
|
||||
assert savedTail.isValid();
|
||||
context.setTailOffset(savedTail.getStartOffset());
|
||||
}
|
||||
else if (o instanceof PsiType){
|
||||
PsiType type = ((PsiType)o).getDeepComponentType();
|
||||
|
||||
Reference in New Issue
Block a user