Git Product home page Git Product logo

denops.vim's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

denops.vim's Issues

Avoid infinity startup loop when Deno executable is invalid

For example, using asdf may produce invalid executable in shims directory and that cause infinity startup loop like below

image

It's not fault of denops.vim but we should avoid infinity startup loop anyway. Maybe we should disable denops after several continuous faults or so on.

error: Uncaught (in worker "helloworld") TS2729 [ERROR]: Property 'initialBufferSize' is used before its initialization.

When --no-check is not applied to g:denops#server#service#deno_args for debugging, the following error is shown on Deno v1,9

[denops] error: Uncaught (in worker "helloworld") TS2729 [ERROR]: Property 'initialBufferSize' is used before its initialization.
[denops]   private view = new DataView(new ArrayBuffer(this.initialBufferSize));
[denops]                                                    ~~~~~~~~~~~~~~~~~
[denops]     at https://deno.land/x/[email protected]/Encoder.ts:17:52
[denops] 
[denops]     'initialBufferSize' is declared here.
[denops]         private readonly initialBufferSize = DEFAULT_INITIAL_BUFFER_SIZE,
[denops]         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[denops]         at https://deno.land/x/[email protected]/Encoder.ts:25:5
[denops] error: 
[denops] Uncaught (in promise) Error: Unhandled error event reached main worker.
[denops]     at Worker.#poll (deno:runtime/js/11_workers.js:269:21)

This issue will be fixed once a new version of msgpack-deno which includes Srinivasa314/msgpack-deno#3 is released

denops.vim does not work if `runtimepath` contains `*` (Neovim 0.6.0-dev)

Wildcards are allowed in runtimepath

	Note that, unlike 'path', no wildcards like "**" are allowed.  Normal
	wildcards are allowed, but can significantly slow down searching for
	runtime files.  For speed, use as few items as possible and avoid
	wildcards.
	See |:runtime|.

But denops.vim does not assume that so it would break denops.vim

Appendix

Neovim 0.6.0-dev use that for some reason and that break denops.vim (neovim/neovim#16031)

Add a way to perform multiple calls in batch

Vim

Now we send redraw command every after call but it's not efficient way. We should prepare a way to send several commands without redraw

Neovim

There are nvim_call_atomic which is prepared for atomic (batch) operation.

Error message is unfriendly when return value serialization failed

Error message is unfriendly when return value serialization failed.

I'm testing in Vim8.2.

These error message is shown when denops.call(...) called.

[denops] Error: Failed to call 'getFoo' with [1]: Error: Failed to call 'call' with ["getbufvar",1,"foo"]: Error: Failed to call 'getbufvar(1, foo)': R

The part of message Error: ...: R, what is R?

If the problem point is Vim's channel implementation, it may be difficult to fix this in denops.vim.

Reproduction

Testing environment:

  • Windows 10
  • Vim 8.2.4732
" vimrc
set nocompatible
language C
" set runtimepath=...

function! Ok() abort
  let b:foo = {'bar': 1}
  call denops#notify('mytest', 'getFoo', [bufnr()])
endfunction

function! FailOnReturn() abort
  let b:foo = {'bar': {-> 1}}
  call denops#notify('mytest', 'getFoo', [bufnr()])
endfunction
// denops/mytest/main.ts
export type { Denops } from "https://deno.land/x/[email protected]/mod.ts";

export function main(denops: Denops) {
  denops.dispatcher = {
    async getFoo(bufNr: unknown): Promise<void> {
      await denops.call('getbufvar', bufNr, 'foo');
    },
  };
}
  1. Setup denops.vim in runtimepath.
  2. Run vim -u vimrc.
  3. Do :call OK(), then nothing.
  4. Do :call FailOnReturn(), then error message is shown.

Others

Full messages

[denops] Error: Failed to call 'getFoo' with [1]: Error: Failed to call 'call' with ["getbufvar",1,"foo"]: Error: Failed to call 'getbufvar(1, foo)': R
[denops]     at Vim.call (file:///tmp/denops.vim/denops/@denops-private/host/vim.ts:33:13)
[denops]     at async Service.call (file:///tmp/denops.vim/denops/@denops-private/service.ts:86:12)
[denops]     at async Session.call (file:///tmp/denops.vim/denops/@denops-private/service.ts:135:14)
[denops]     at async Session.dispatch (https://deno.land/x/[email protected]/session.ts:99:12)
[denops]     at async https://deno.land/x/[email protected]/session.ts:108:18
[denops]     at async Session.handleRequest (https://deno.land/x/[email protected]/session.ts:104:29)
[denops]     at Session.call (https://deno.land/x/[email protected]/session.ts:207:13)
[denops]     at async DenopsImpl.call (file:///tmp/denops.vim/denops/@denops/impl.ts:28:12)
[denops]     at async Session.getFoo (file:///tmp/denops-test/denops/mytest/main.ts:6:7)
[denops]     at async Session.dispatch (https://deno.land/x/[email protected]/session.ts:99:12)
[denops]     at async https://deno.land/x/[email protected]/session.ts:108:18
[denops]     at async Session.handleRequest (https://deno.land/x/[email protected]/session.ts:104:29)
[denops]     at Session.call (https://deno.land/x/[email protected]/session.ts:207:13)
[denops]     at async Service.dispatch (file:///tmp/denops.vim/denops/@denops-private/service.ts:101:14)
[denops]     at async dispatch (file:///tmp/denops.vim/denops/@denops-private/host/vim.ts:81:12)
[denops]     at async Session.<anonymous> (file:///tmp/denops.vim/denops/@denops-private/host/vim.ts:53:14)

Bug: job#start mismatch args between vim/nvim

function! s:start(args, options) abort

function! s:start(context, args, options) abort

Detect args mismatch.

see error (report other person)

[denops] Vim(return):E119: 関数の引数が足りません: s:start
[denops] VimEnter Autocommands for "*"..function denops#server#start[1]..denops#server#channel#start[7]..denops#lib#promise#new[1]..<SNR>106_new[5]..<SNR>151_start[4]..denops#lib#job#start, 行 10

Failed to send massive data through RPC

[denops] channel server start: ['/usr/local/bin/deno', 'run', '-q', '--no-check', '--allow-net', '/Users/alisue/ghq/github.com/vim-denops/denops.vim/denops/denops/cli/channel.ts']
[denops] channel server resolve: {"hostname":"127.0.0.1","port":64602,"transport":"tcp"}
[denops] service server start: ['/usr/local/bin/deno', 'run', '-q', '--no-check', '--unstable', '-A', '/Users/alisue/ghq/github.com/vim-denops/denops.vim/denops/denops/cli/service.ts', '--mode=nvim', '--address={"hostname":"127.0.0.1","port":64602,"transport":"tcp"}']
[denops] register `getline-test` plugin as `/Users/alisue/.config/nvim/pack/minpac/start/dps-getline-test/denops/getline-test/mod.ts`
[denops] register `asyngrep` plugin as `/Users/alisue/.config/nvim/pack/minpac/start/dps-asyngrep/denops/asyngrep/mod.ts`
[denops] register `helloworld` plugin as `/Users/alisue/.config/nvim/pack/minpac/start/denops-helloworld.vim/denops/helloworld/mod.ts`
[denops] register `helloworld_raw` plugin as `/Users/alisue/.config/nvim/pack/minpac/start/denops-helloworld.vim/denops/helloworld_raw/mod.ts`
[denops] getline-test has loaded
[denops] denops-helloworld.vim (std) has loaded
[denops] denops-helloworld.vim (raw) has loaded
[coc.nvim] Server languageserver.ccls failed to start: Launching server "languageserver.ccls" using command ccls failed.
[denops] Unexpected data received: ^I^Ibreak;
[denops] Unexpected data received: ^I    if (!do_all)
[denops] Unexpected data received: ^I^Ibreak;
[denops] Unexpected data received: ^I}
[denops] Unexpected data received: 
[denops] Unexpected data received: ^Iif (ga.ga_data != NULL)
[denops] Unexpected data received: ^I    STRCPY((char *)ga.ga_data + ga.ga_len, tail);
[denops] Unexpected data received: 
[denops] Unexpected data received: ^Ivim_regfree(regmatch.regprog);
[denops] Unexpected data received:     }
[denops] Unexpected data received: 
[denops] Unexpected data received:     ret = vim_strsave(ga.ga_data == NULL ? str : (char_u *)ga.ga_data);
[denops] Unexpected data received:     ga_clear(&ga);
[denops] Unexpected data received:     if (p_cpo == empty_option)
[denops] Unexpected data received: ^Ip_cpo = save_cpo;
[denops] Unexpected data received:     else
[denops] Unexpected data received:     {
[denops] Unexpected data received: ^I// Darn, evaluating {sub} expression or {expr} changed the value.
[denops] Unexpected data received: ^I// If it's still empty it was changed and restored, need to restore in
[denops] Unexpected data received: ^I// the complicated way.
[denops] Unexpected data received: ^Iif (*p_cpo == NUL)
[denops] Unexpected data received: ^I    set_option_value((char_u *)"cpo", 0L, save_cpo, 0);
[denops] Unexpected data received: ^Ifree_string_option(save_cpo);
[denops] Unexpected data received:     }
[denops] Unexpected data received: 
[denops] Unexpected data received:     return ret;
[denops] Unexpected data received: }
  1. Install https://github.com/lambdalisue/dps-getline-test
  2. Clone https://github.com/vim/vim
  3. Open src/eval.c in above repository
  4. Execute call denops#notify('getline-test', 'benchmarkGetLines', [])

Failing to connect to denops server

Recently I keep getting [denops] Failed to connect denops server: Failed to connect 127.0.0.1:port error messages and autocomplete stops working. Here's the full message after :let g:denops#debug = 1 | call denops#server#restart():

[denops] Server spawned: ['deno', 'run', '-q', '--no-check', '--unstable', '-A', '/Users/ldavis/dotfiles/.vim
/plugged/denops.vim/denops/@denops-private/cli.ts', '--mode=vim']
[denops] DenopsStarted
[denops] Connecting to `127.0.0.1:53944`
[denops] Failed to connect denops server: Failed to connect `127.0.0.1:53944`
[denops] Server stopped: -1
[denops] DenopsStopped

I tried switching from deno 1.17.0 to the latest version 1.22.0 but this did nothing. I'm using macOS 12.4 (Monterey). I've also updated to the latest version of denops.vim with :PlugUpdate and the latest version of vim: 8.2.3901.

Anything else I can do to try to debug this? I tried manually running the command deno run -q --no-check --unstable -A /Users/ldavis/dotfiles/.vim/plugged/denops.vim/denops/@denops-private/cli.ts --mode=vim and it seems to work fine... for some reason vim is just unable to connect with ch_open... it's really strange.

Out dated deno's dependency

Starting neovim:

[denops] docker: TypeError: Import 'https://dev.jspm.io/[email protected]/index.js' failed: 500 Internal Server Error
[denops]     at https://deno.land/x/[email protected]/vendor/https/dev.jspm.io/react/index.js:4:32
  • neovim config:
use {
  'vim-denops/denops.vim',
}
  • neovim version: 0.8.0
  • deno versión:
    deno 1.25.2 (release, x86_64-unknown-linux-gnu)
    v8 10.6.194.5
    typescript 4.7.4

Pull request #200 not working

Unable to access denops commands from MacVim

I'm probably doing something wrong. Sorry for bothering you. When running vim from the terminal, I can run the :DenopsHello command from denops-helloworld.vim. However, when I use MacVim, I cannot run the :DenopsHello command.

In the terminal, when I try to use ddu.vim commands, everything works. In MacVim, I get an error which says [denops] Failed to wait for "ddu" to start. Denops server itself is not started.

Any thoughts?

`input()` returns `null` on MacVim 8.2.2681 when `g:denops#debug = 1` is specified in vimrc

  1. Add let g:denops#debug = 1 in .vimrc
  2. Start Vim
  3. Execute HelloWorld on denops-helloworld.vim
Messages maintainer: Bram Moolenaar <[email protected]>
[denops] channel server start: ['deno', 'run', '-q', '--no-check', '--allow-net', '/Users/alisue/ghq/github.com/vim-denops/denops.vim/denops/@denops-private/channel/cli.ts']
[denops] service server start: ['deno', 'run', '-q', '--unstable', '-A', '/Users/alisue/ghq/github.com/vim-denops/denops.vim/denops/@denops-private/service/cli.ts', '--mode=vim', '--address={"transport":"tcp","hostname":"127.0.0.1","port":57856}']
[denops] register plugin: ['ghosttext', '/Users/alisue/.vim/pack/minpac/start/dps-ghosttext.vim/denops/ghosttext/main.ts', {'platform': 'mac', 'host': 'vim', 'mode': 'debug', 'version': '8.2.2681'}, {'reload': v:false}]
[denops] register plugin: ['gin', '/Users/alisue/.vim/pack/minpac/start/gin.vim/denops/gin/main.ts', {'platform': 'mac', 'host': 'vim', 'mode': 'debug', 'version': '8.2.2681'}, {'reload': v:false}]
[denops] register plugin: ['helloworld', '/Users/alisue/.vim/pack/minpac/start/denops-helloworld.vim/denops/helloworld/main.ts', {'platform': 'mac', 'host': 'vim', 'mode': 'debug', 'version': '8.2.2681'}, {'reload': v:false}]
[denops] register plugin: ['benchmark', '/Users/alisue/.vim/pack/minpac/start/denops-benchmark/denops/benchmark/main.ts', {'platform': 'mac', 'host': 'vim', 'mode': 'debug', 'version': '8.2.2681'}, {'reload': v:false}]
[denops] channel server resolve: {"transport":"tcp","hostname":"127.0.0.1","port":57856}

Hello World. Your name is null. This is Vim

Somehow, it doesn't happen when let g:denops#debug = 1 is specified with call denops#server#restart() after Vim startup.

Some problems in Vim8/neovim

  1. The cursor is flickered when use ddc.vim in Vim8. It seems when the popup window is displayed, the cursor will be hidden. I don't know why.

  2. The mode string in the echoarea is redrawn when the popup window is displayed in both Vim8 and neovim.

Minimal vimrc

if &compatible
  set nocompatible
endif

set runtimepath^=~/work/ddc.vim
set runtimepath^=~/work/ddc-around
set runtimepath^=~/work/ddc-matcher_head
set runtimepath^=~/work/ddc-sorter_rank
set runtimepath+=~/src/denops.vim

filetype plugin indent on
syntax enable

call ddc#custom#patch_global('sources', ['around'])
"call ddc#custom#patch_global('completionMode', 'inline')
"call ddc#custom#patch_global('completionMode', 'manual')
call ddc#custom#patch_global('sourceOptions', {
      \ '_': {
      \   'ignoreCase': v:true,
      \   'matchers': ['matcher_head'],
      \   'sorters': ['sorter_rank'],
      \ },
      \ 'around': {'mark': 'A'},
      \ })
call ddc#enable()

ReferenceError: __DENO_NODE_GLOBAL_THIS_xxxxxxxxxx__ is not defined

It seems using npm:diff cause the following error

image

Reproduce

Add the following lines to the bottom of example-minimal/main.ts of vim-denops/denops-helloworld.vim

import * as diff from "npm:diff";
console.log(diff.diffChars("foo", "bar"));

Reproduced with

  • Deno 1.25.4 with/without deno.jsonc
  • Deno 1.26.2 with/without deno.jsonc
  • Deno 1.27.2 without deno.jsonc
  • Deno 1.28.3 without deno.jsonc

Couldn't reproduced with

  • Deno 1.27.2 with deno.jsonc
  • Deno 1.28.3 with deno.jsonc

Can't boot denops.vim in no internet connection environment.

Hi.
I'm using denops.vim for skkeleton(Japanese input method plugin for vim).
It works fine in during to connect the internet.
But I tried to launch skkeleton in no internet connection environment, I've got a under error message and can't enable denops.vim.

[denops] Server stopped 3 times within 10000 millisec. Denops become disabled to avoid infinity restart loop.

denops needs the internet connection always?

My environment:
Debian 11
Vim 8.2 Included patches: 1-4103
Installed denops.vim and skkeleton via vim-plug

denops die suddenly and could not alive by itself

Error detected while processing function gin#action#fn[3]..<lambda>1184[1]..<SNR>410_edit[6]..<lambda>1188[1]..<SNR>101_command[4]..denops#request[1]..denops#server#request[6]..<SNR>248_request:
line    1:
Error invoking 'invoke' on channel 7:
Invalid channel: 7
[denops] Error: Failed to call 'command' with [["commit","-v"]]: Error: Failed to call 'batch' with [["denops#api#cmd","echohl ErrorMsg",{}],["denops#api#cmd","redraw | echo message",{"message":"[gin]: Failed to call 'call' with [\"denops#api#cmd\",\"do <nomodeline> User GinCommandPost\",{}]: SessionClosedError: The session is closed\n    at Session.close (https://deno.land/x/[email protected]/session.ts:179:31)\n    at Session.dispose (https://deno.land/x/[email protected]/session.ts:171:10)\n    at Neovim.dispose (file:///Users/alisue/ghq/github.com/vim-denops/denops.vim/denops/@denops-private/host/nvim.ts:58:19)\n    at using (https://deno.land/x/[email protected]/using.ts:16:20)\n    at async file:///Users/alisue/ghq/github.com/vim-denops/denops.vim/denops/@denops-private/cli.ts:30:3"}],["denops#api#cmd","echohl None",{}]]: SessionClosedError: The session is closed
[denops]     at Session.call (https://deno.land/x/[email protected]/session.ts:195:13)
[denops]     at Neovim.batch (file:///Users/alisue/ghq/github.com/vim-denops/denops.vim/denops/@denops-private/host/nvim.ts:29:44)
[denops]     at Service.batch (file:///Users/alisue/ghq/github.com/vim-denops/denops.vim/denops/@denops-private/service.ts:92:29)
[denops]     at Session.batch (file:///Users/alisue/ghq/github.com/vim-denops/denops.vim/denops/@denops-private/service.ts:140:28)
[denops]     at Session.dispatch (https://deno.land/x/[email protected]/session.ts:99:42)
[denops]     at https://deno.land/x/[email protected]/session.ts:108:29
[denops]     at Session.handleRequest (https://deno.land/x/[email protected]/session.ts:114:7)
[denops]     at Session.listen (https://deno.land/x/[email protected]/session.ts:148:16)
[denops]     at Session.call (https://deno.land/x/[email protected]/session.ts:207:13)
[denops]     at async DenopsImpl.batch (file:///Users/alisue/ghq/github.com/vim-denops/denops.vim/denops/@denops/impl.ts:35:31)
[denops]     at async batch (https://deno.land/x/[email protected]/batch/batch.ts:94:3)
[denops]     at async echoerr (https://deno.land/x/[email protected]/helper/echo.ts:33:3)
[denops]     at async Module.friendlyCall (https://deno.land/x/[email protected]/helper/echo.ts:57:7)
[denops]     at async Session.dispatch (https://deno.land/x/[email protected]/session.ts:99:12)
[denops]     at async https://deno.land/x/[email protected]/session.ts:108:18
[denops]     at async Session.handleRequest (https://deno.land/x/[email protected]/session.ts:104:29)
[denops]     at Session.call (https://deno.land/x/[email protected]/session.ts:207:13)
[denops]     at async Service.dispatch (file:///Users/alisue/ghq/github.com/vim-denops/denops.vim/denops/@denops-private/service.ts:101:14)
[denops]     at async Session.invoke (file:///Users/alisue/ghq/github.com/vim-denops/denops.vim/denops/@denops-private/host/nvim.ts:48:16)
[denops]     at async Session.dispatch (https://deno.land/x/[email protected]/session.ts:99:12)
[denops]     at async Session.handleNotification (https://deno.land/x/[email protected]/session.ts:130:7)

I needed to restart denops manually with

call denops#server#restart()

The failure callback will be executed if the success callback of `denops#request_async()` throws an exception.

  • denops/sample/main.ts
import { Denops } from "https://deno.land/x/denops_std/mod.ts";

export function main(denops: Denops): Promise<void> {
  denops.dispatcher = {
    test(): Promise<string> {
      return Promise.resolve("test done")
    }
  }
  return Promise.resolve();
}
  • plugin/sample.vim
function! Hoge()
  call denops#request_async("sample", "test", [], function("s:on_success"), function("s:on_failure"))
endfunction

function! s:on_success(...)
  echom a:000
  throw "hoge"
endfunction

function! s:on_failure(...)
  echom a:000
endfunction

When I wrote the above and executed the Hoge() function, I got the following output

:call Hoge()
s:on_success
['test done']
s:on_failure
[{}]

The empty output after on_failure is due to issue #112.

Bug: `nvim +"autocmd VimEnter * qa!"` would be stuck.

Env

  • vim/nvim: nvim
  • vim/nvim --version: NVIM v0.5.0
  • platform: WSL2 Ubuntu20.04
  • denops.vim version: from v1.10.1 to latest ( v2.0.0 )

Repro

  1. Just install denops.vim.
" Install vim-plug
" let &rtp .= ',' . expand('<sfile>:h')
call plug#begin(expand('<sfile>:h/plugged'))
Plug 'vim-denops/denops.vim'
call plug#end()
  1. nvim +"autocmd VimEnter * qa!"

Expect

nvim finishes.

Actual

nvim was stuck.

[denops] Server stopped (143). Restarting...

and I should stop this by hitting CTRL-C.

image

More

I confirmed it's come from call denops#server#start()

Support for import_map.json?

Hey I've been using this to build my own plugin, and really enjoying it 😄 over at https://github.com/creativenull/projectlocal-vim

I've noticed that import_map.json don't work the way it would on a normal deno project (which is expected as this is for building plugins), I was wondering if there would be any support if it's possible to use an import map to simplify imports in denops, instead of directly importing from a url or from within a dep/ directory?

Failed to connect denops server with Deno 1.15.0

After a recent system update (Arch Linux) I see the following error when starting nvim with dein (sorry, I'm not sure if this error is on the denops or dein side)

[denops] error: Uncaught ReferenceError: charset is not defined
[denops] [charset.QUOTATION_MARK]: charset.QUOTATION_MARK,
[denops] ^
[denops] at https://deno.land/x/[email protected]/utils/utf-8.ts:105:4
[denops] Failed to connect denops server: Vim(let):connection failed: tcp address must be host:port

Here are relevant versions that I can think of

$ nvim -ver
NVIM v0.5.1
Build type: Release
LuaJIT 2.0.5

$ deno --version
deno 1.15.0 (release, x86_64-unknown-linux-gnu)
v8 9.5.172.19
typescript 4.4.2

And here is a minimal init.vim. When I completely clear out my dein cache and then start nvim with this file, it will install denops and after a few seconds give the above error

" .#vimrc

" Required:
set runtimepath+=/home/ryantr/.cache/dein/repos/github.com/Shougo/dein.vim
call dein#begin('/home/ryantr/.cache/dein')
call dein#add('/home/ryantr/cache/dein/repos/github.com/Shougo/dein.vim')
call dein#add('vim-denops/denops.vim')
call dein#end()

if dein#check_install()
  call dein#install()
endif

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

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/[email protected]/mod.ts";
import { execute } from "https://deno.land/x/[email protected]/helper/mod.ts";
import * as vars from "https://deno.land/x/[email protected]/variable/mod.ts";
import * as autocmd from "https://deno.land/x/[email protected]/autocmd/mod.ts";
import { ensureString } from "https://deno.land/x/[email protected]/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/[email protected]/session.ts:98:6)^@    at async https://deno.land/x/[email protected]/session.ts:108:15^@    at async Session.handleRequest (https://deno.land/x/[email protected]/session.ts:104:25)^@    at Session.call (https://deno.land/x/[email protected]/session.t

Environment

Vim 8.2.3206
denops.vim 89195f3

💥 Rewrite denops to provide new API interface

Currently, denops uses object style like

await denops.call(...);

But it's a bit confusing while third party won't make such methods.
That's why we decided to change that API interface to like

import { call } from "...";

await call(denops, ...);

Typo(?) in the README.md

In the readme, vim-denops/denops-helloworld.vim is introduced as a test of installation. It instructs to type :HelloDenops command, but this gives an error E492: Not an editor command: HelloDenops.

Seeing the denops-helloworld.vim repository, :DenopsHello command is introduced, and it works well in my environment. Is the :HelloDenops command in the readme of this repository a typo of :DenopsHello?

My Vim environment

  • Ubuntu 20.04
  • Vim 8.2.3459
  • deno 1.14.2 (release, x86_64-unknown-linux-gnu)
  • v8 9.4.146.16
  • typescript 4.4.2

Failed to convert error to JSON in `denops#request_async()`

I wrote following code:

function! do()
  call denops#request_async('some_plugin', 'someFunc', [], function('s:on_success'), function('s:on_failure'))
endfunction

function! s:on_failure(...)
  echom a:000
endfunction

function! s:on_success(...)
  " do something
endfunction

When an exception occurs in the calling someFunc, [{}] is displayed in s:on_failure.

denops#server#restart() does not work properly

Hello!
After executing call denops#server#restart() in Denops, when I execute :DenopsHello, it exits with the following error. This error also occurs when I run any Denops plugin other than DenopsHello.

function denops#request[1]..denops#server#request の処理中にエラーが検出されました:
行    4:
E605: 例外が捕捉されませんでした: The server is not ready yet

My current environment is as follows.

-OS Manjaro Linux

DISTRIB_ID=ManjaroLinux
DISTRIB_RELEASE=21.3.0
DISTRIB_CODENAME=Ruah
DISTRIB_DESCRIPTION="Manjaro Linux"
  • Vim Neovim
NVIM v0.8.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=cold -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/coma/neovim/build/config -I/home/coma/neovim/src -I/home/coma/neovim/.deps/usr/include -I/usr/include -I/home/coma/neovim/build/src/nvim/auto -I/home/coma/neovim/build/include
Compiled by coma@ComaBook

Features: +acl +iconv +tui
See ":help feature-compile"

      システム vimrc: "$VIM/sysinit.vim"
       省略時の $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

Denops commit hash is f967ee0730804649d340ec409d5e97c76dacf817(HEAD).

Thanks!

Check if `deno` is executable in `plugin.vim` to fix E474: Invalid argument

When deno is not available from Vim, the error message is quite un-user-friendly like

Error detected while processing VimEnter Autocommands for "*"..function denops#server#start[6]..denops#server#channel#start[11]..denops#util#jobstart[10]..<SNR>128_start:
line    8:
E474: Invalid argument

So we should check if deno is available in plugin.vim and show more user-friendly error messages so that users can solve the issue by themselves.

Add a way to pass one-time callback function from Deno to Vim script

Opposite to denops#callback#.... It is mainly used to write a library code like

await Buffer.open("new-buffer", {
  onClosed: () => {
    // Code here is invoked when the buffer is closed.
  },
});

To make this kind of feature, we need to invoke onClosed callback on BufWinLeave autocmd or whatever but it's not possible for now without exposing onClosed callback as plugin API.

Background: https://vim-jp.slack.com/archives/C01N4L5362D/p1622640308360400

Deno freeze using denops.vim

Denops.vim does not work when I start/restart Vim or neovim repeatedly.
And deno CPU usage is very high.

スクリーンショット_2021-08-05_09-46-01

Minimal vimrc

if &compatible
  set nocompatible
endif

set runtimepath^=~/work/ddc.vim
set runtimepath^=~/work/ddc-around
set runtimepath^=~/work/ddc-matcher_head
set runtimepath^=~/work/ddc-sorter_rank
set runtimepath+=~/src/denops.vim

filetype plugin indent on
syntax enable

call ddc#custom#patch_global('sources', ['around'])
"call ddc#custom#patch_global('completionMode', 'inline')
"call ddc#custom#patch_global('completionMode', 'manual')
call ddc#custom#patch_global('sourceOptions', {
      \ '_': {
      \   'ignoreCase': v:true,
      \   'matchers': ['matcher_head'],
      \   'sorters': ['sorter_rank'],
      \ },
      \ 'around': {'mark': 'A'},
      \ })
call ddc#enable()

To reproduce the problem, you need to start insert mode and input characters repeatedly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.