IJPL-207762 cleanup CodeCompletionHandlerBase

GitOrigin-RevId: bf5bf9387e49a1301468f4b045e6183eb42d1a1f
This commit is contained in:
Max Medvedev
2026-02-13 14:33:15 +00:00
committed by intellij-monorepo-bot
parent 801e5dfa34
commit fff008b4d4
@@ -219,7 +219,8 @@ public class CodeCompletionHandlerBase {
boolean hasValidContext = context != null;
if (!hasValidContext) {
PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(caret, project);
PsiFile psiFile = Objects.requireNonNull(PsiUtilBase.getPsiFileInEditor(caret, project),
"PsiFile must exist here, otherwise completion won't even come here");
context = new CompletionInitializationContextImpl(editor, caret, psiFile, completionType, effectiveInvocationCount);
}
@@ -629,7 +630,8 @@ public class CodeCompletionHandlerBase {
context = lastContext.get();
}
else {
PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, project);
PsiFile psiFile = Objects.requireNonNull(PsiUtilBase.getPsiFileInEditor(editor, project),
"PsiFile must exist here, otherwise completion won't even come here");
context = insertItem(items, item, completionChar, editor, psiFile, caretOffset, idEndOffset, offsetMap);
}
return context;