mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[terminal] IJPL-220485 Fix exception during terminal popup completion statistics collection
When lookup is reused, it can be closed without new last selected item set by `LAST_SELECTED_ITEM_KEY`. So, the `LAST_SELECTED_ITEM_KEY` can point to the `LookupElement` from the previous content of the lookup. While reused lookup will contain new `LookupArranger` instance, that will throw an exception if an unrelated lookup element is passed into `itemPattern` method. Fix it by clearing the `LAST_SELECTED_ITEM_KEY` value when lookup is reused. GitOrigin-RevId: 13c6607d0bf33bce3d08c6b769deec9290f34062
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ea56f7a84e
commit
ca0d2bca29
+2
@@ -15,6 +15,7 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.terminal.frontend.action.TerminalFrontendDataContextUtils.terminalOutputModel
|
||||
import com.intellij.terminal.frontend.view.impl.toRelative
|
||||
import org.jetbrains.plugins.terminal.block.reworked.TerminalCommandCompletion
|
||||
import org.jetbrains.plugins.terminal.block.util.TerminalDataContextUtils.terminalEditor
|
||||
import org.jetbrains.plugins.terminal.view.TerminalOutputModel
|
||||
|
||||
@@ -102,6 +103,7 @@ internal class TerminalCommandCompletionHandler(
|
||||
val existing = LookupManager.getActiveLookup(editor) as? LookupImpl
|
||||
if (existing != null && existing.isCompletion) {
|
||||
existing.markReused()
|
||||
existing.putUserData(TerminalCommandCompletion.LAST_SELECTED_ITEM_KEY, null)
|
||||
if (!autopopup) {
|
||||
existing.setLookupFocusDegree(LookupFocusDegree.FOCUSED)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user