How can I know if a vscode intelliSense suggestion is visible?

23 views Asked by At

I am creating an inline code completion plugin for vscode.

I am using the InlineCompletionItemProvider to show the inline suggestions.

However, I am making the call to generate suggestion even when an IntelliSense popup is visible. This is an unnecessary call for me as the suggestion I have will not be visible until and unless the user closes the intelliSense popup. I want to reduce this unnecessary cost.

Is there a way to identify whether intelliSense popup is visible or not. So that I can not call inline completions when the popup is visible.

Any help or direction will be much appreciated.

1

There are 1 answers

0
Mark On

This would be another case where a getContext() api would be useful - to get current context keys. Because there is a suggestWidgetVisible context key. Unfortunately the request for getContext() has been mostly shut down. See add getContext command.

But you can add your use case here: Lift setContext from a command to proper API which remains open apparently just for getContext() since setContext() has been implemented.