coc-extensions / coc-svelte

svelte support for (Neo)Vim
MIT License
178 stars 24 forks source link

Auto closing of html tags closes the tag with the parent element when both coc-svelte and coc-html are installed #48

Open salaerts opened 2 years ago

salaerts commented 2 years ago

If I have both coc-svelte and coc-html loaded, with html.autoClosingTags: true then I get some weird behavior.

Suppose I have this code:

        <dl>
            <dt>Term</dt>
            <dd>Description</dd>
        </dl>

If at this point I add another

after the
element, the auto closure functionality closes the tag with </dl>dt>:

        <dl>
            <dt>Term</dt>
            <dd>Description</dd>
            <dt></dl>dt>
        </dl>

I can reproduce this with any HTML element.

If I only install coc-html, the auto closing feature works as expected. When I only use coc-svelte I have no auto close functionality. Not sure if this is the correct repo to report this issue.

Setting html.autoClosingTags to false acts as a workaround but of course disables auto closure entirely.

petergarnaes commented 1 year ago

You can set svelte.plugin.html.completions.enable to true, and this will enable you to have auto closing tags for .svelte files without using coc-html.

You can then maybe disable coc-html for svelte files and have it work correctly?