[extract method] remove redundant method

GitOrigin-RevId: 9b47742682fdb7e16d33987d4f64e1d34666ffde
This commit is contained in:
Alexandr Suhinin
2024-08-07 11:08:20 +00:00
committed by intellij-monorepo-bot
parent 877b9af14a
commit 6b014fa166
2 changed files with 3 additions and 14 deletions
@@ -31,7 +31,6 @@ import com.intellij.refactoring.extractMethod.newImpl.structures.InputParameter
import com.intellij.refactoring.util.RefactoringUtil
import com.intellij.refactoring.util.VariableData
import com.siyeh.ig.psiutils.ClassUtils
import kotlinx.coroutines.suspendCancellableCoroutine
import java.util.concurrent.CompletableFuture
object ExtractMethodPipeline {
@@ -144,17 +143,6 @@ object ExtractMethodPipeline {
.toList()
}
suspend fun selectOption(editor: Editor, options: List<ExtractOptions>): ExtractOptions {
require(options.isNotEmpty())
val project = options.first().project
return suspendCancellableCoroutine { continuation ->
selectOptionWithTargetClass(editor, project, options)
.thenApply { selectedOption ->
continuation.resumeWith(Result.success(selectedOption))
}
}
}
fun selectOptionWithTargetClass(editor: Editor, project: Project, options: List<ExtractOptions>): CompletableFuture<ExtractOptions> {
require(options.isNotEmpty())
if (options.size == 1) {
@@ -24,7 +24,7 @@ import com.intellij.refactoring.extractMethod.ExtractMethodHandler
import com.intellij.refactoring.extractMethod.newImpl.ExtractMethodHelper.guessMethodName
import com.intellij.refactoring.extractMethod.newImpl.ExtractMethodHelper.replaceWithMethod
import com.intellij.refactoring.extractMethod.newImpl.ExtractMethodPipeline.findAllOptionsToExtract
import com.intellij.refactoring.extractMethod.newImpl.ExtractMethodPipeline.selectOption
import com.intellij.refactoring.extractMethod.newImpl.ExtractMethodPipeline.selectOptionWithTargetClass
import com.intellij.refactoring.extractMethod.newImpl.ExtractMethodPipeline.withFilteredAnnotations
import com.intellij.refactoring.extractMethod.newImpl.inplace.*
import com.intellij.refactoring.extractMethod.newImpl.parameterObject.ResultObjectExtractor
@@ -35,6 +35,7 @@ import com.intellij.refactoring.util.CommonRefactoringUtil
import com.intellij.refactoring.util.ConflictsUtil
import com.intellij.util.containers.MultiMap
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.future.await
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.jetbrains.annotations.NonNls
@@ -85,7 +86,7 @@ class MethodExtractor {
val preparePlacesTime = System.currentTimeMillis() - prepareStart
val options = withContext(Dispatchers.EDT) {
selectOption(editor, descriptorsForAllTargetPlaces)
selectOptionWithTargetClass(editor, file.project, descriptorsForAllTargetPlaces).await()
}
if (EditorSettingsExternalizable.getInstance().isVariableInplaceRenameEnabled) {
val templateStart = System.currentTimeMillis()