coc-extensions / coc-svelte

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

Switching between Svelte files and other file types lead to an annoying error #55

Open nima-dvlp opened 2 years ago

nima-dvlp commented 2 years ago

Description

Trying to type / or > on any file type except for the Svelte files, leads to this error at the bottom of the screen :

[coc.nvim]: UnhandledRejection: Request html/tag failed with message: Cannot call methods on an unopened document
Error: Request html/tag failed with message: Cannot call methods on an unopened document
    at gu (/home/nima/.local/share/nvim/plugged/coc.nvim/build/index.js:38:224)
    at bp (/home/nima/.local/share/nvim/plugged/coc.nvim/build/index.js:37:11261)
    at Immediate.<anonymous> (/home/nima/.local/share/nvim/plugged/coc.nvim/build/index.js:37:11111)
    at processImmediate (node:internal/timers:466:21)

How to reproduce :

Open a svelte file(activate Svelte LSP), open another file type(ts, js, json, anything except svelte), then try to issue / or > in insert mode, this error hits, and it's so destructive!

What it is

I think this is how you try to handle closing tags like below:

<SvelteComponent>    </
<!--                  ^ here / issued -->

Why there is an html/tag request for other filetypes than Svelte or HTML?

freddyshim commented 1 year ago

I'm experiencing the same issue and it's very annoying. Can we get this fix merged to master?