in src/org/jetbrains/r/editor/RCompletionAutoPopupHandler.kt [27:56]
override fun checkAutoPopup(charTyped: Char, project: Project, editor: Editor, file: PsiFile): Result {
if (file.fileType !in listOf(RFileType, RoxygenFileType) && file.virtualFile?.fileType != RMarkdownFileType) return Result.CONTINUE
val offset = editor.caretModel.offset
if (identifierPart(charTyped)) {
if (!REditorSettings.disableCompletionAutoPopupForShortPrefix) {
return Result.CONTINUE
}
if (offset < identifierPrefixLength) {
return Result.STOP
}
val content = editor.document.charsSequence
return if (identifierPart(content[offset - 1]) && identifierPart(content[offset - 2])) {
Result.CONTINUE
} else {
Result.STOP
}
}
if (charTyped != '$' && charTyped != ':' && charTyped != '/' && charTyped != '\\') return Result.CONTINUE
AutoPopupController.getInstance(project).scheduleAutoPopup(editor) l@{ psiFile ->
val element = psiFile.findElementAt(offset) ?: return@l false
val parent = element.parent ?: return@l false
if (parent is RNamespaceAccessExpression && parent.identifier == null) return@l true
if (isSubsetOperator(element)) return@l true
if (parent is RStringLiteralExpression && charTyped == '/' || charTyped == '\\') return@l true
return@l false
}
return Result.STOP
}