fannheyward / coc-deno

Deno extension for coc.nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deno/virtualTextDocument does not work properly with the latest version of Vim/Neovim

yaegassy opened this issue · comments

Since the patch of Vim v8.2.3468, deno/virtualTextDocument does not work properly.

Neovim has also incorporated this patch and is no longer working properly as well.

This may perhaps need to be adjusted in "coc.nvim" itself.

However, I am a little worried because the scope of influence seems to be very large...

I'm sorry. I forgot to include the trace log. The "uri" sent by deno/virtualTextDocument is broken

nvim (v0.6.0):

[Trace - 18:56:00] Sending request 'deno/virtualTextDocument - (3)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/yaegassy/sandbox/deno-check/deno%3A/https/deno.land/std%400.116.0/io/util.ts"
    }
}


The source was not found: file:///Users/yaegassy/sandbox/deno-check/deno:/https/deno.land/std@0.116.0/io/util.ts

nvim (v0.5.1):

[Trace - 18:57:01] Sending request 'deno/virtualTextDocument - (5)'.
Params: {
    "textDocument": {
        "uri": "deno:/https/deno.land/std%400.116.0/io/util.ts"
    }
}

It's not an essential solution, but it did work by rewriting the URI on the extension side as a workaround.

(@yuki-yano Thanks for the idea.)

diff --git a/src/content_provider.ts b/src/content_provider.ts
index e902807..d3ba3cb 100644
--- a/src/content_provider.ts
+++ b/src/content_provider.ts
@@ -19,7 +19,7 @@ export class DenoTextDocumentContentProvider
   ): ProviderResult<string> {
     return this.client.sendRequest(
       virtualTextDocument,
-      { textDocument: { uri: uri.toString() } },
+      { textDocument: { uri: uri.toString().replace('%3A', ':').replace(`file:\/\/${process.cwd()}/`, '') } },
       token,
     );
   }