vim-denops / denops.vim

🐜 An ecosystem of Vim/Neovim which allows developers to write cross-platform plugins in Deno

Home Page:https://vim-denops.github.io/denops-documentation/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] nested `denops request` was broken one time with Vim8

kuuote opened this issue · comments

Repro step

  1. Install denops.vim and denops-helloworld.vim.
  2. replace denops-helloworld.vim/denops/helloworld/main.ts to below code.
import { Denops } from "https://deno.land/x/denops_std@v1.0.0-beta.8/mod.ts";
import { execute } from "https://deno.land/x/denops_std@v1.0.0-beta.8/helper/mod.ts";
import * as vars from "https://deno.land/x/denops_std@v1.0.0-beta.8/variable/mod.ts";
import * as autocmd from "https://deno.land/x/denops_std@v1.0.0-beta.8/autocmd/mod.ts";
import { ensureString } from "https://deno.land/x/unknownutil@v0.1.1/mod.ts";

// Export `main` function which is executed from denops.vim
export async function main(denops: Denops) {
  denops.dispatcher = {
    async say(): Promise<void> {
      await denops.eval("input('test')");
    },
    async ho(): Promise<string> {
      return "hoge";
    }
  };

  // Use 'execute()' to execute multiline Vim script
  await execute(
    denops,
    `
    command! Test call denops#request("${denops.name}", "say", [])
    cnoremap <expr> Q denops#request("${denops.name}", "ho", [])
    `,
  );
}
  1. Run Vim and execute :Test command.
  2. Repeat press Q

Problem

  1. Temporalily freeze and inserted 0 to buffer.
  2. Then an below error occurs at escape from input.
Error detected while processing function denops#request[1]..denops#server#channel#request[4]..<SNR>103_request[3]..function denops#request[1]..denops#server#channel#request[4]..<SNR>103_request:
line    3:
E605: Exception not caught: Error: Failed to call 'say' with []: Error: Failed to call 'call' with ["denops#api#eval","input('test')",{}]: Error: Failed to call 'denops#api#eval(input('test'), [object Object])': dispatch^@    at Vim.callForDebug (file:///tmp/dein/cache/vim/.cache/vimrc/.dein/denops/@denops-private/service/host/vim.ts:49:13)^@    at async Vim.call (file:///tmp/dein/cache/vim/.cache/vimrc/.dein/denops/@denops-private/service/host/vim.ts:70:8)^@    at async Service.call (file:///tmp/dein/cache/vim/.cache/vimrc/.dein/denops/@denops-private/service/service.ts:86:65)^@    at async Session.call (file:///tmp/dein/cache/vim/.cache/vimrc/.dein/denops/@denops-private/service/service.ts:60:25)^@    at async Session.dispatch (https://deno.land/x/msgpack_rpc@v3.1.0/session.ts:98:6)^@    at async https://deno.land/x/msgpack_rpc@v3.1.0/session.ts:108:15^@    at async Session.handleRequest (https://deno.land/x/msgpack_rpc@v3.1.0/session.ts:104:25)^@    at Session.call (https://deno.land/x/msgpack_rpc@v3.1.0/session.t

Environment

Vim 8.2.3206
denops.vim 89195f3