mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
commit may change psiFile instance, completion should be prepared to that (EA-46770)
This commit is contained in:
+6
-8
@@ -113,9 +113,6 @@ public class CodeCompletionHandlerBase {
|
||||
CompletionLookupArranger.applyLastCompletionStatisticsUpdate();
|
||||
}
|
||||
|
||||
final PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, project);
|
||||
assert psiFile != null : "no PSI file: " + FileDocumentManager.getInstance().getFile(editor.getDocument());
|
||||
|
||||
checkNoWriteAccess();
|
||||
|
||||
CompletionAssertions.checkEditorValid(editor);
|
||||
@@ -131,8 +128,6 @@ public class CodeCompletionHandlerBase {
|
||||
return;
|
||||
}
|
||||
|
||||
psiFile.putUserData(PsiFileEx.BATCH_REFERENCE_PROCESSING, Boolean.TRUE);
|
||||
|
||||
CompletionPhase phase = CompletionServiceImpl.getCompletionPhase();
|
||||
boolean repeated = phase.indicator != null && phase.indicator.isRepeatedInvocation(myCompletionType, editor);
|
||||
/*
|
||||
@@ -167,10 +162,13 @@ public class CodeCompletionHandlerBase {
|
||||
public void run() {
|
||||
EditorUtil.fillVirtualSpaceUntilCaret(editor);
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
||||
|
||||
CompletionAssertions.assertCommitSuccessful(editor, psiFile);
|
||||
CompletionAssertions.checkEditorValid(editor);
|
||||
|
||||
final PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, project);
|
||||
assert psiFile != null : "no PSI file: " + FileDocumentManager.getInstance().getFile(editor.getDocument());
|
||||
psiFile.putUserData(PsiFileEx.BATCH_REFERENCE_PROCESSING, Boolean.TRUE);
|
||||
CompletionAssertions.assertCommitSuccessful(editor, psiFile);
|
||||
|
||||
initializationContext[0] = runContributorsBeforeCompletion(editor, psiFile);
|
||||
}
|
||||
};
|
||||
@@ -179,7 +177,7 @@ public class CodeCompletionHandlerBase {
|
||||
};
|
||||
if (autopopup) {
|
||||
CommandProcessor.getInstance().runUndoTransparentAction(initCmd);
|
||||
if (!restarted && shouldSkipAutoPopup(editor, psiFile)) {
|
||||
if (!restarted && shouldSkipAutoPopup(editor, initializationContext[0].getFile())) {
|
||||
CompletionServiceImpl.setCompletionPhase(CompletionPhase.NoCompletion);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user