mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
[inline-completion] IJPL-161906: add docs for InlineCompletionFilteringEventListener
(cherry picked from commit 0f2733053df1523237ddb17a979f806379bc5973) IJ-MR-147762 GitOrigin-RevId: 11c5a03fafe229b07fd1efa42e04d0536dc18206
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d4c591aed8
commit
c6fb9a7efe
@@ -5,13 +5,18 @@ import com.intellij.codeInsight.inline.completion.InlineCompletionEventAdapter
|
||||
import com.intellij.codeInsight.inline.completion.InlineCompletionEventType
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
/**
|
||||
* If a request is applicable corresponding to [isApplicable], then everything works as usual.
|
||||
*
|
||||
* If a request is not applicable, the listener doesn't call any methods on all the events connected to the request.
|
||||
*/
|
||||
internal abstract class InlineCompletionFilteringEventListener : InlineCompletionEventAdapter {
|
||||
|
||||
private val isApplicable = AtomicBoolean(true)
|
||||
|
||||
protected abstract fun isApplicable(requestEvent: InlineCompletionEventType.Request): Boolean
|
||||
|
||||
override fun on(event: InlineCompletionEventType) {
|
||||
final override fun on(event: InlineCompletionEventType) {
|
||||
if (event is InlineCompletionEventType.Request) {
|
||||
isApplicable.set(isApplicable(event))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user