Vim错误“在处理函数~AND时发生错误”“E716:字典中不存在键”的解决方案

huangapple go评论68阅读模式
英文:

Vim Error "An error occurred while processing function ~AND" "E716: Key not present in Dictionary~" Solution

问题

■错误描述。

在处理函数<SNR>35_debounceTimeTimerCallback[1].. <SNR>35_tapSourceCallback[4].. <SNR>35_tapSourceCallback[1].. <lambda>30[1].. <SNR>55_set_signs[10].. <SNR>55_place_signs时检测到错误:
第5行:
E716:字典中不存在该键:linecount + 1

■错误内容输出的原因
我已经在VirtusalBox上使用Vim编辑器设置了Go开发环境。

■.vimrc文件的内容

call plug#begin('~/.vim/plugged')
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
call plug#end()

我不确定解决方案,你能告诉我吗?

英文:

■Error Description.

Error detected while processing function &lt;SNR&gt;35_debounceTimeTimerCallback[1]..
&lt;SNR&gt;35_tapSourceCallback[4]..&lt;SNR&gt;35_tapSourceCallback[1]..&lt;lambda&gt;30[1]..&lt;SNR
&gt;55_set_signs[10]..&lt;SNR&gt;55_place_signs:
line    5:
E716: Key not present in Dictionary: linecount + 1

■Cause of error content output
I have set up an environment for Go development using the Vim editor on VirtusalBox.

■Contents of .vimrc

call plug#begin(&#39;~/.vim/plugged&#39;)
Plug &#39;prabirshrestha/vim-lsp&#39;
Plug &#39;mattn/vim-lsp-settings&#39;
call plug#end()

I am unsure of the solution, can you please let me know?

答案1

得分: 1

你可以使用:help :scriptnames命令查看Vim已经加载的文件列表:

:scr

堆栈跟踪中所有<SNR>XX中的XX指的是上述命令输出中的脚本编号XX

例如,在我的机器上使用$ vim --clean命令执行:scr的输出如下:

  1: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/defaults.vim
  2: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/filetype.vim
  3: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/ftplugin.vim
  4: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/indent.vim
  5: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/syntax.vim
  6: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/synload.vim
  7: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/syncolor.vim

如果我得到一个提到<SNR>4的堆栈跟踪,我就知道问题出在Vim附带的~/Applications/MacVim.app/Contents/Resources/vim/runtime/indent.vim文件中。在这个虚构的情况下,我可能会进一步调试,并在Vim的问题跟踪器上提交一个问题。

在你的情况下,问题很可能发生在你的某个插件中。一旦你确定了问题所在,你应该前往插件的问题跟踪器。

英文:

You can see a list of the files that have been sourced by Vim with :help :scriptnames:

:scr

The XX in all the &lt;SNR&gt;XXs in the stack trace refers to script number XX in the output of the command above.

For example, this is the output of :scr in $ vim --clean on my machine:

  1: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/defaults.vim
  2: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/filetype.vim
  3: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/ftplugin.vim
  4: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/indent.vim
  5: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/syntax.vim
  6: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/synload.vim
  7: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/syncolor.vim

If I get a stack trace mentioning &lt;SNR&gt;4, I know the problem is in the ~/Applications/MacVim.app/Contents/Resources/vim/runtime/indent.vim file that comes with Vim. In this fictitious case, I would probably debug it a little bit further and open an issue on Vim's issue tracker.

In your case, the problem is very likely to happen in one of your plugins. Once you have identified it, you should head off to its issue tracker.

答案2

得分: 1

这可能是vim-lsp的一个bug。

这个拉取请求在3天前合并到主分支。从**~/.vim/plugged/vim-lsp/autoload/lsp/internal/diagnostics/signs.vim**中删除以下行对我有用。

" Some language servers report an unexpected EOF one line past the end
if l:line == getbufinfo(a:bufnr)[0].linecount + 1
    let l:line = l:line - 1
endif
英文:

It could be a bug of vim-lsp.

This pull request was merged to master 3 days ago. Removing the following lines from ~/.vim/plugged/vim-lsp/autoload/lsp/internal/diagnostics/signs.vim worked for me.

&quot; Some language servers report an unexpected EOF one line past the end
if l:line == getbufinfo(a:bufnr)[0].linecount + 1
    let l:line = l:line - 1
endif

huangapple
  • 本文由 发表于 2022年9月28日 16:10:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/73878168.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定