mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
[fleet] inline refactoring for python
GitOrigin-RevId: 8b17bfd232e7daaa7203b156724ec402252000d7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1bd891a46d
commit
3f30ddebff
@@ -44,6 +44,11 @@ class PyInlineFunctionHandler : InlineActionHandler() {
|
||||
}
|
||||
|
||||
override fun inlineElement(project: Project?, editor: Editor?, element: PsiElement?) {
|
||||
invoke(project, editor, element)
|
||||
}
|
||||
|
||||
fun invoke(project: Project?, editor: Editor?, element: PsiElement?, showDialog: Boolean = true,
|
||||
inlineThisOnly: Boolean = false) {
|
||||
if (project == null || editor == null || element !is PyFunction) return
|
||||
val functionScope = ControlFlowCache.getScope(element)
|
||||
val error = when {
|
||||
@@ -68,10 +73,11 @@ class PyInlineFunctionHandler : InlineActionHandler() {
|
||||
CommonRefactoringUtil.showErrorHint(project, editor, error, PyPsiBundle.message("refactoring.inline.function.title"), REFACTORING_ID)
|
||||
return
|
||||
}
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode){
|
||||
if (showDialog && !ApplicationManager.getApplication().isUnitTestMode) {
|
||||
PyRefactoringUiService.getInstance().showPyInlineFunctionDialog(project, editor, element, findReference(editor))
|
||||
} else {
|
||||
val processor = PyInlineFunctionProcessor(project, editor, element, findReference(editor), false, true)
|
||||
}
|
||||
else {
|
||||
val processor = PyInlineFunctionProcessor(project, editor, element, findReference(editor), inlineThisOnly, true)
|
||||
processor.setPreviewUsages(false)
|
||||
processor.run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user