mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 02:09:59 +07:00
IJ-CR-150136 Revert "LLM-11798 make suggestTitle suspend and check default name for the change list"
This reverts commit 31164f741219c9b957db3f7a223852d88927acfa. (cherry picked from commit 81e86ecace5f1ce4ea767e2557815ebf61708c74) GitOrigin-RevId: daf254c08de0646c2be2190cc62fa068983deb71
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fe87189f90
commit
d66864249f
@@ -3,33 +3,28 @@ package com.intellij.vcs
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vcs.changes.LocalChangeList.getAllDefaultNames
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import java.awt.Component
|
||||
import java.util.function.Consumer
|
||||
|
||||
interface ShelveTitleProvider {
|
||||
|
||||
/**
|
||||
* Create a custom title for shelved changes
|
||||
*/
|
||||
suspend fun suggestTitle(project: Project, patch: ShelveTitlePatch): String?
|
||||
fun suggestTitle(project: Project, patch: ShelveTitlePatch, rename: Consumer<String>): Boolean
|
||||
|
||||
/**
|
||||
* Show got it tooltip popup if applicable
|
||||
* Show tooltip popup if applicable
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
fun showGotItPopup(project: Project, component: Component): Boolean
|
||||
fun showTooltipPopup(project: Project, component: Component): Boolean
|
||||
|
||||
companion object {
|
||||
val EP_NAME: ExtensionPointName<ShelveTitleProvider> = ExtensionPointName<ShelveTitleProvider>("com.intellij.vcs.shelve.name")
|
||||
|
||||
@JvmStatic
|
||||
fun showGotItTooltip(project: Project, component: Component) {
|
||||
EP_NAME.extensionList.any { it.showGotItPopup(project, component) }
|
||||
EP_NAME.extensionList.any { it.showTooltipPopup(project, component) }
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun hasDefaultName(name: String): Boolean = getAllDefaultNames().contains(name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,8 +64,6 @@ import com.intellij.vcsUtil.FilesProgress;
|
||||
import com.intellij.vcsUtil.VcsImplUtil;
|
||||
import com.intellij.vcsUtil.VcsUtil;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlinx.coroutines.CoroutineScope;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.Parent;
|
||||
@@ -401,10 +399,7 @@ public final class ShelveChangesManager implements PersistentStateComponent<Elem
|
||||
changeList.markToDelete(markToBeDeleted);
|
||||
|
||||
if (Registry.is("llm.vcs.shelve.title.generation")) {
|
||||
if (ShelveTitleProvider.hasDefaultName(commitMessage)) {
|
||||
ShelveChangesNameSuggester.INSTANCE.suggestBetterName(myProject, new ShelveTitlePatch(Files.readString(patchFile), patches.size()),
|
||||
name -> renameChangeList(changeList, name));
|
||||
}
|
||||
suggestBetterName(new ShelveTitlePatch(Files.readString(patchFile), patches.size()), name -> renameChangeList(changeList, name));
|
||||
}
|
||||
|
||||
changeList.setName(schemePatchDir.getFileName().toString());
|
||||
@@ -421,6 +416,14 @@ public final class ShelveChangesManager implements PersistentStateComponent<Elem
|
||||
}
|
||||
}
|
||||
|
||||
private void suggestBetterName(@NotNull ShelveTitlePatch patch, @NotNull Consumer<String> rename) {
|
||||
for (@NotNull ShelveTitleProvider provider : ShelveTitleProvider.Companion.getEP_NAME().getExtensionList()) {
|
||||
if (provider.suggestTitle(myProject, patch, rename)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<FilePatch> buildAndSavePatchInBatches(@NotNull Path patchFile,
|
||||
@NotNull List<Change> textChanges,
|
||||
boolean honorExcludedFromCommit) throws IOException, VcsException {
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.vcs.changes.shelf
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.vcs.ShelveTitlePatch
|
||||
import com.intellij.vcs.ShelveTitleProvider
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.function.Consumer
|
||||
|
||||
object ShelveChangesNameSuggester {
|
||||
fun suggestBetterName(project: Project, patch: ShelveTitlePatch, rename: Consumer<String>) {
|
||||
ShelveChangesManager.getInstance(project).coroutineScope.launch {
|
||||
rename.accept(ShelveTitleProvider.EP_NAME.getIterable().firstNotNullOf { it?.suggestTitle(project, patch) })
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user