# Autocompletions added by my plugin to HTML aren't selecting the first entry in the list

**URL:** <https://platform.jetbrains.com/t/autocompletions-added-by-my-plugin-to-html-arent-selecting-the-first-entry-in-the-list/3537>\
**Category:** IntelliJ Platform\
**Created:** [January 20, 2026, 2:04am UTC](https://platform.jetbrains.com/t/autocompletions-added-by-my-plugin-to-html-arent-selecting-the-first-entry-in-the-list/3537 "2026-01-20T02:04:05Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![illuminatedcloud](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/illuminatedcloud/32/55_2.png) [@illuminatedcloud](https://platform.jetbrains.com/u/illuminatedcloud)\
**Post date:** [January 20, 2026, 2:04am UTC](https://platform.jetbrains.com/t/autocompletions-added-by-my-plugin-to-html-arent-selecting-the-first-entry-in-the-list/3537/1 "2026-01-20T02:04:05Z")

</div>

My plugin is adding completions to HTML files, and one thing that’s kind of odd is that during autocompletion, the first entry in the completions list is not automatically selected, and pressing **Tab** or **Enter** inserts a paired HTML element based on the typed text:

![HTML_Completions_Issue](https://us1.discourse-cdn.com/flex001/uploads/jetbrains_platform/original/2X/9/9224a417900a3d1c72db118ac1be81087be2953e.gif)

As you can see above, I reproduce that behavior once, then I repeat the process and explicitly use the **Down** key to choose the first completion so that it’s inserted on **Tab** or **Enter**.

Is there any way I can override this behavior for these specific completions?

---

<div class="post-metadata">

**Author:** ![maxmedvedev](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/maxmedvedev/32/2954_2.png) [@maxmedvedev](https://platform.jetbrains.com/u/maxmedvedev)\
**Post date:** [January 20, 2026, 9:45am UTC](https://platform.jetbrains.com/t/autocompletions-added-by-my-plugin-to-html-arent-selecting-the-first-entry-in-the-list/3537/4 "2026-01-20T09:45:52Z")

</div>

Hi Scott,

What IJ Platform version do you use? Does updating to the latest version help?

Do you observe the same behaviour (no item selected) without your plugin?

> My plugin is adding completions to HTML files

Could you explain how exactly you add items? Do you just register your CompletionProvider or you have some additional code that spawns completion lookup?

---

<div class="post-metadata">

**Author:** ![illuminatedcloud](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/illuminatedcloud/32/55_2.png) [@illuminatedcloud](https://platform.jetbrains.com/u/illuminatedcloud)\
**Post date:** [January 20, 2026, 4:30pm UTC](https://platform.jetbrains.com/t/autocompletions-added-by-my-plugin-to-html-arent-selecting-the-first-entry-in-the-list/3537/5 "2026-01-20T16:30:09Z")

</div>

> [@maxmedvedev](#):
>
> What IJ Platform version do you use? Does updating to the latest version help?

This is all on the latest, though I’ve seen this behavior for quite a long time.

> [@maxmedvedev](#):
>
> Do you observe the same behaviour (no item selected) without your plugin?

Well, that’s difficult to say because without my plugin, there are no additional completions being added to try to reproduce the behavior.

> [@maxmedvedev](#):
>
> Could you explain how exactly you add items? Do you just register your CompletionProvider or you have some additional code that spawns completion lookup?

Yeah, it’s just a standard `completion.contributor` EP implementation that uses `extend` to register a `CompletionProvider` that in turn creates `LookupElements` and adds them to the provided `CompletionResultSet`. This is one of ~20 completion providers added by my plugin, and the only ones that behave in this manner are the ones that add completions to HTML files. There seems to be something specific about how completions are handled in that language/file type – specifically autocompletions – that results in this “unfocused” completion selector.

Let me know if there’s any other info I can provide.

---

<div class="post-metadata">

**Author:** ![maxmedvedev](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/maxmedvedev/32/2954_2.png) [@maxmedvedev](https://platform.jetbrains.com/u/maxmedvedev)\
**Post date:** [January 20, 2026, 4:53pm UTC](https://platform.jetbrains.com/t/autocompletions-added-by-my-plugin-to-html-arent-selecting-the-first-entry-in-the-list/3537/6 "2026-01-20T16:53:47Z")

</div>

Could you also provide steps to repro?

---

<div class="post-metadata">

**Author:** ![jansorg](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/jansorg/32/52_2.png) [@jansorg](https://platform.jetbrains.com/u/jansorg)\
**Post date:** [January 20, 2026, 4:58pm UTC](https://platform.jetbrains.com/t/autocompletions-added-by-my-plugin-to-html-arent-selecting-the-first-entry-in-the-list/3537/7 "2026-01-20T16:58:38Z")

</div>

@illuminatedcloud I think you’re seeing Emmet/Zen coding tag insertion. You can turn the feature of in the settings to see if that’s the culprit.  
I don’t know how to override that, though 😔

---

<div class="post-metadata">

**Author:** ![illuminatedcloud](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/illuminatedcloud/32/55_2.png) [@illuminatedcloud](https://platform.jetbrains.com/u/illuminatedcloud)\
**Post date:** [January 20, 2026, 5:03pm UTC](https://platform.jetbrains.com/t/autocompletions-added-by-my-plugin-to-html-arent-selecting-the-first-entry-in-the-list/3537/8 "2026-01-20T17:03:50Z")

</div>

Good thought, and that’s definitely coming into play here. If I disable Emmet in HTML, **Tab** doesn’t insert the element pair…but it also doesn’t insert any of the offered completions because none is selected by default:

![HTML_Completions_Issue_2](https://us1.discourse-cdn.com/flex001/uploads/jetbrains_platform/original/2X/c/cdae1f98434c17534a158aac320052af74c3a050.gif)

My guess is that if there was an initial selection, it would behave as desired/expected without having to disable/override Emmet.

But that does explain the current behavior. Good eye!

---

<div class="post-metadata">

**Author:** ![illuminatedcloud](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/illuminatedcloud/32/55_2.png) [@illuminatedcloud](https://platform.jetbrains.com/u/illuminatedcloud)\
**Post date:** [January 20, 2026, 5:04pm UTC](https://platform.jetbrains.com/t/autocompletions-added-by-my-plugin-to-html-arent-selecting-the-first-entry-in-the-list/3537/9 "2026-01-20T17:04:47Z")

</div>

> [@maxmedvedev](#):
>
> Could you also provide steps to repro?

It’s going to require my plugin to be installed, so let me see if I can come up with the easiest/most straightforward repoduction steps for you. More to come shortly…

---

<div class="post-metadata">

**Author:** ![maxmedvedev](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/maxmedvedev/32/2954_2.png) [@maxmedvedev](https://platform.jetbrains.com/u/maxmedvedev)\
**Post date:** [January 20, 2026, 5:18pm UTC](https://platform.jetbrains.com/t/autocompletions-added-by-my-plugin-to-html-arent-selecting-the-first-entry-in-the-list/3537/11 "2026-01-20T17:18:50Z")

</div>

It seems that `com.intellij.codeInsight.completion.HtmlCompletionContributor#shouldTryDeselectingFirstPopupItem` gets into your way. IIUC there is no way to customize its behavior from a plugin.

Could you create a ticket for WebStorm about this issue? [https://youtrack.jetbrains.com/newIssue?project=web](https://youtrack.jetbrains.com/newIssue?project=web)

Thanks for reaching out!

---

<div class="post-metadata">

**Author:** ![illuminatedcloud](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/illuminatedcloud/32/55_2.png) [@illuminatedcloud](https://platform.jetbrains.com/u/illuminatedcloud)\
**Post date:** [January 20, 2026, 5:21pm UTC](https://platform.jetbrains.com/t/autocompletions-added-by-my-plugin-to-html-arent-selecting-the-first-entry-in-the-list/3537/12 "2026-01-20T17:21:19Z")

</div>

Done:

> **[HtmlCompletionContributor#shouldTryDeselectingFirstPopupItem interferes with...](https://youtrack.jetbrains.com/issue/WEB-76438)**
>
> Please see this discussion for context:...

Sounds like you don’t need anything special to help reproduce now, correct?

---

<div class="post-metadata">

**Author:** ![illuminatedcloud](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/illuminatedcloud/32/55_2.png) [@illuminatedcloud](https://platform.jetbrains.com/u/illuminatedcloud)\
**Post date:** [January 20, 2026, 5:32pm UTC](https://platform.jetbrains.com/t/autocompletions-added-by-my-plugin-to-html-arent-selecting-the-first-entry-in-the-list/3537/13 "2026-01-20T17:32:11Z")

</div>

Based on that lead, I was able to implement `completion.htmlInTextCompletionPopupExtension` to return `true` from `isDeselectingFirstItemDisabled` when the provided element is in a context where my plugin specifically contributes completions. That provides the desired/expected behavior, and given that I’m very carefully only returning `true` in the exact scenario where my plugin contributes completions, it shouldn’t change the standard HTML behavior.

That EP is annotated as `@ApiStatus.Internal`, but I’m assuming you’re okay with me implementing it until/unless the YT issue linked above is addressed, no?

---

<div class="post-metadata">

**Author:** ![maxmedvedev](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/maxmedvedev/32/2954_2.png) [@maxmedvedev](https://platform.jetbrains.com/u/maxmedvedev)\
**Post date:** [January 21, 2026, 1:51pm UTC](https://platform.jetbrains.com/t/autocompletions-added-by-my-plugin-to-html-arent-selecting-the-first-entry-in-the-list/3537/14 "2026-01-21T13:51:20Z")

</div>

Correct, the situation is clear.

Please continue the discussion in the ticket as this API is part of WebStorm and not IJ Platform.
