mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 17:03:12 +07:00
[RDCT] IJPL-162126: Fix availability hints exceptions
`EditorActionAvailabilityHintHandler` adds hints on every highlighter update. If there is a highlighter with action availability hints and subsequent updates, these hints will be added multiple times, causing `logger.error`. The same happens in some other places like `InlinePromptHighlightingPassFactory` which may add hints several times. This commit changes the assertion from "log error if there is a hint already" to "log error only if there is a *different* hint for this action". It skips already existing hints if they are exactly the same. GitOrigin-RevId: 83e88ba3a050e291b5634341dd7526620623858f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e435d75b2b
commit
db7891da87
+7
-3
@@ -161,10 +161,14 @@ private fun UserDataHolderEx.addActionAvailabilityHintImpl(vararg newHints: Edit
|
||||
putUserDataIfAbsent(hintsKey, hints)
|
||||
}
|
||||
for (newHint in newHints) {
|
||||
if (hints.any { it.actionId == newHint.actionId }) {
|
||||
logger.error("Availability hint for action '${newHint.actionId}' already exists")
|
||||
return
|
||||
val existingHint = hints.find { it.actionId == newHint.actionId }
|
||||
if (existingHint != null) {
|
||||
if (existingHint.condition != newHint.condition) {
|
||||
logger.error("Availability hint for action '${newHint.actionId}' already exists")
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
hints.add(newHint)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user