英文:
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 <SNR>35_debounceTimeTimerCallback[1]..
<SNR>35_tapSourceCallback[4]..<SNR>35_tapSourceCallback[1]..<lambda>30[1]..<SNR
>55_set_signs[10]..<SNR>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('~/.vim/plugged')
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
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 <SNR>XX
s 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 <SNR>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.
" 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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论