Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occurs when changing selected item while preview is running. #48

Closed
tennashi opened this issue Mar 16, 2023 · 1 comment
Closed

Comments

@tennashi
Copy link

Warning: I will close the issue without the minimal init.vim and the
reproduction instructions.

Problems summary

Changing the selected item in the preview window when the command specified by TerminalPreviewer has not finished raises E948.

function <lambda>11[1]..<SNR>33_do_auto_action[13]..ddu#ui#ff#do_action[17]..ddu#ui_action[1]..ddu#_request[22]..denops#request[1].
.denops#server#request[4]..denops#_internal#server#chan#request[4]..denops#_internal#rpc#vim#request[3]..function <lambda>11[1]..<S
NR>33_do_auto_action[13]..ddu#ui#ff#do_action[17]..ddu#ui_action[1]..ddu#_request[22]..denops#request[1]..denops#server#request[4].
.denops#_internal#server#chan#request[4]..denops#_internal#rpc#vim#request の処理中にエラーが検出されました:
行    3:
E605: 例外が捕捉されませんでした: Error: Failed to call 'uiAction' with ["default","preview",{}]: BatchError: Vim(enew):E948: ジョ>
ブはまだ実行中です (! を追加でジョブを終了)^@function <lambda>11[1]..<SNR>33_do_auto_action[13]..ddu#ui#ff#do_action[17]..ddu#ui_ac
tion[1]..ddu#_request[22]..denops#request[1]..denops#server#request[4]..denops#_internal#server#chan#request[4]..denops#_internal#r
pc#vim#request[1]..denops#api#vim#batch[4]..denops#api#cmd, 行 2^@    at DenopsImpl.batch (file:///home/tennashi/src/github.com/vim
-denops/denops.vim/denops/@denops-private/impl.ts:55:13)^@    at async batch (https://deno.land/x/denops_std@v4.0.0/batch/batch.ts:
199:3)^@    at async PreviewUi.previewContentsTerminal (file:///home/tennashi/.vim/pack/volt/opt/github.com_Shougo_ddu-ui-ff/denops
/@ddu-ui-ff/preview.ts:167:7)^@    at async PreviewUi.previewContents (file:///home/tennashi/.vim/pack/volt/opt/github.com_Shougo_d
du-ui-ff/denops/@ddu-ui-ff/preview.ts:107:14)^@    at async Ddu.uiAction (file:

Expected

Interrupts the execution of a command and executes the next command.

Environment Information

  • ddu.vim version (SHA1): 07e9a28

  • denops.vim version (SHA1): 8f3899de3d3add07105221262dca90a31c4c2d4c

  • deno version(deno -V output): deno 1.31.1

  • OS: Linux (6.1.0-4-amd64)

  • neovim/Vim :version output:

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Mar  4 2023 19:53:01)
適用済パッチ: 1-1376

Provide a minimal init.vim/vimrc without plugin managers (Required!)

" Your minimal init.vim/vimrc
set runtimepath+=~/path/to/ddu.vim/
set runtimepath+=~/path/to/ddu-ui-ff/
set runtimepath+=~/path/to/test_kind/

call ddu#custom#patch_global({
\ 'uiParams': {
\   'ff': {
\     'autoAction': {'name': 'preview'},
\   },
\ },
\})
  • ~/path/to/test_kind/denops/@ddu-sources/test.ts
import { BaseSource, Item } from "https://deno.land/x/ddu_vim@v2.3.0/types.ts";
import { GatherArguments } from "https://deno.land/x/ddu_vim@v2.3.0/base/source.ts";
import { ActionData } from "../@ddu-kinds/test.ts";

type Params = Record<never, never>;

export class Source extends BaseSource<Params> {
  kind = "test";

  gather(_args: GatherArguments<Params>): ReadableStream<Item<ActionData>[]> {
    return new ReadableStream({
      start(controler) {
        controler.enqueue([
          { word: "test-1", action: { time: 10 } },
          { word: "test-2", action: { time: 20 } },
          { word: "test-3", action: { time: 30 } },
        ]);
        controler.close();
      },
    });
  }

  params(): Params {
    return {};
  }
}
  • ~/path/to/test_kind/denops/@ddu-kinds/test.ts
import {
  ActionArguments,
  ActionFlags,
  BaseKind,
  Previewer,
} from "https://deno.land/x/ddu_vim@v2.4.0/types.ts";
import { GetPreviewerArguments } from "https://deno.land/x/ddu_vim@v2.4.0/base/kind.ts";
import { term_start } from "https://deno.land/x/denops_std@v4.0.0/function/vim/mod.ts";

type Params = Record<never, never>;

export type ActionData = {
  time: number;
}

export class Kind extends BaseKind<Params> {
  actions: Record<
    string,
    (args: ActionArguments<Params>) => Promise<ActionFlags>
  > = {};

  getPreviewer(args: GetPreviewerArguments): Promise<Previewer | undefined> {
    const action = args.item.action as ActionData
    return Promise.resolve({
      kind: "terminal",
      cmds: ["sleep", action.time],
    });
  }

  params(): Params {
    return {};
  }
}

How to reproduce the problem from neovim/Vim startup (Required!)

  1. :call ddu#start({'ui': 'ff', 'sources': [{'name': 'test'}]})
  2. jj (invoke 2 preview commands)

Screenshot (if possible)

Upload the log messages by :redir and :message (if errored)

@Shougo
Copy link
Owner

Shougo commented Mar 16, 2023

Please update ddu-ui-ff. It is not ddu.vim error.

@Shougo Shougo closed this as completed Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants