IJPL-252099 fix duplicated prefix

(cherry picked from commit c98a44ce047376fea8db120a4d730f67c41bd4eb)

GitOrigin-RevId: e0e3da83422e24cb3239c67e989e8ca0d61b6c43
This commit is contained in:
Max Medvedev
2026-08-17 18:54:15 +00:00
committed by intellij-monorepo-bot
parent b7ba59b912
commit cee3a88548
@@ -42,14 +42,23 @@ sealed interface RpcLookupElementEvent {
/**
* the lookup is closed with completion
*
* [requestId] is the request the chosen item belongs to, and it is what the backend must resolve
* [selectedItemId] against: items live in a per-request storage
* (`BackendCompletionRequestSession.findCompletionResult`), and the mirror lookup's arranger can still belong to an
* older request when this event is handled (IJPL-252099 — the frontend swaps a stale-seeded request for a fresh one
* right before the accept). Resolving against the arranger's own session instead would fail to find the item and
* insert one carrying a shorter prefix matcher, leaving the leading typed characters in the document.
*/
@Serializable
data class ItemSelected(
val projectId: ProjectId,
val requestId: RpcCompletionRequestId,
val selectedItemId: RpcCompletionItemId? = null,
) : RpcLookupElementEvent {
override fun toString(): String = buildToString("ItemSelected") {
field("projectId", projectId)
field("requestId", requestId)
fieldWithNullDefault("selectedItemId", selectedItemId)
}
}