jayli / jayli/vim-easycomplete

跳转定义只能使用一次

Open
#212 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Vim Script
Stars
436
Forks
27
PR merge metrics
No merged PRs in 30d

Description

## 问题描述

您好,最近我发现插件的跳转定义命令`:EasyCompleteGotoDefinition`只有在打开文件的第一次可用,当我返回原位置并重新输入这个命令时,就显示`No defination found`,另外,使用`ctrl + ]`进行跳转始终显示`No defination found`。详细说明如下:

打开一个C语言文件:在一个函数引用出输入命令`:EasyCompleteGotoDefinition`,此时成功跳转到了函数`dbGetLink`的定义处
![图片](https://user-images.githubusercontent.com/60341709/170332200-25afe0a6-d02d-4e2b-8802-c7c18ea21dc9.png)

而当我使用`ctrl + o`返回原位置,再次输入命令`:EasyCompleteGotoDefinition`,提示了`No defination found`。
![图片](https://user-images.githubusercontent.com/60341709/170331781-5b8c010e-fec3-4d5b-bf2f-944d6d39e4e2.png)

好像这个命令只能在打开文件后使用一次,而当我每次使用`ctrl + ]`时,都是提示`No defination found`。不知道是什么原因造成的,我的插件的配置是:
```bash
" easycomplete
let g:easycomplete_diagnostics_enable = 0
let g:easycomplete_lsp_checking = 0
```
我的vim版本是:
```bash
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar 29 2022 11:40:47)
Included patches: 1-4643
Compiled by zhangzhao@debian
Huge version without GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_urxvt -tag_any_white
+arabic +find_in_path +mouse_xterm -tcl
+autocmd +float +multi_byte +termguicolors
+autochdir +folding +multi_lang +terminal
-autoservername -footer -mzscheme +terminfo
-balloon_eval +fork() +netbeans_intg +termresponse
+balloon_eval_term -gettext +num64 +textobjects
-browse -hangul_input +packages +textprop
++builtin_terms +iconv +path_extra +timers
+byte_offset +insert_expand +perl +title
+channel +ipv6 +persistent_undo -toolbar
+cindent +job +popupwin +user_commands
+clientserver +jumplist +postscript +vartabs
+clipboard +keymap +printer +vertsplit
+cmdline_compl +lambda +profile +vim9script
+cmdline_hist +langmap -python +viminfo
+cmdline_info +libcall +python3 +virtualedit
+comments +linebreak +quickfix +visual
+conceal +lispindent +reltime +visualextra
+cryptv +listcmds +rightleft +vreplace
+cscope +localmap +ruby +wildignore
+cursorbind -lua +scrollbind +wildmenu
+cursorshape +menu +signs +windows
+dialog_con +mksession +smartindent +writebackup
+diff +modify_fname -sodium +X11
+digraphs +mouse -sound +xfontset
-dnd -mouseshape +spell -xim
-ebcdic +mouse_dec +startuptime -xpm
+emacs_tags -mouse_gpm +statusline +xsmp_interact
+eval -mouse_jsbterm -sun_workshop +xterm_clipboard
+ex_extra +mouse_netterm +syntax -xterm_save
+extra_search +mouse_sgr +tag_binary
-farsi -mouse_sysmouse -tag_old_static
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-z,relro -Wl,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -L/usr/local/lib -Wl,--as-needed -o vim -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lselinux -ldl -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.34/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.10/config-3.10-x86_64-linux-gnu -lpython3.10 -lcrypt -lpthread -ldl -lutil -lm -lm -lruby-3.0 -lm -L/usr/lib
```

在 `.config/vim-easycomplete`的错误记录(打开文件执行跳转然后返回再重新执行跳转的全部过程)
```bash
----- Easycomplete Errlog ------
2022 5月 26 02时14分01秒 devAiSoft.c [ERR] notification <---(stderr) 2 clangd ["I[02:14:01.007] Debian clangd version 13.0.1-4","I[02:14:01.007] Features: linux+grpc","I[02:14:01.007] PID: 337234","I[02:14:01.007] Working directory: /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev","I[02:14:01.007] argv[0]: clangd","I[02:14:01.007] Starting LSP over stdin/stdout","I[02:14:01.007] <-- initialize(1)","I[02:14:01.007] --> reply:initialize(1) 0 ms","I[02:14:01.125] <-- initialized","I[02:14:01.125] <-- textDocument/didOpen",""]
2022 5月 26 02时14分01秒 devAiSoft.c [ERR] {"response":{"data":{"path":"file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c","__data__":"vim-lsp","server_name":"clangd"},"message":"not dirty"}}
2022 5月 26 02时14分01秒 devAiSoft.c [LOG] notification ---> 2 clangd
2022 5月 26 02时14分01秒 devAiSoft.c [LOG] s:update_file_content() 1
2022 5月 26 02时14分01秒 devAiSoft.c [LOG] {"response":{"data":{"__data__":"vim-lsp","server_name":"clangd"},"message":"configuration sent"}}
2022 5月 26 02时14分01秒 devAiSoft.c [LOG] notification ---> 2 clangd
2022 5月 26 02时14分01秒 devAiSoft.c [LOG] lsp response <--- 2 clangd
2022 5月 26 02时14分01秒 devAiSoft.c [LOG] {"response":{"data":{"__data__":"vim-lsp","lsp_id":2,"server_name":"clangd"},"message":"started lsp server successfully"}}
2022 5月 26 02时14分01秒 devAiSoft.c [LOG] Starting server clangd ["clangd"]
2022 5月 26 02时14分01秒 devAiSoft.c [LOG] s:on_text_document_did_open() 1 c /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c
2022 5月 26 02时14分01秒 devAiSoft.c [LOG] easycomplete#lsp#register_server server registered clangd
2022 5月 26 02时14分01秒 devAiSoft.c [ERR] You should set Diagnostic jumping map-key manully Vim(nnoremap):E227: mapping already exists for
2022 5月 26 02时14分01秒 devAiSoft.c [LOG] Easycomplete Startup /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c
2022 5月 26 02时14分01秒 devAiSoft.c [ERR] notification <---(stderr) 2 clangd ["I[02:14:01.128] Failed to find compilation database for /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c","I[02:14:01.128] ASTWorker building file /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c version 1 with command clangd fallback","[/home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev]","/usr/bin/clang -resource-dir=/usr/lib/llvm-13/lib/clang/13.0.1 -- /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c",""]
2022 5月 26 02时14分01秒 devAiSoft.c [ERR] notification <---(stderr) 2 clangd ["I[02:14:01.174] --> textDocument/publishDiagnostics",""]
2022 5月 26 02时14分01秒 devAiSoft.c [LOG] lsp response <--- 2 clangd
2022 5月 26 02时14分07秒 devAiSoft.c [LOG] s:on_text_document_did_open() 4 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/%5BWilder%20Popup%201%5D
2022 5月 26 02时14分07秒 devAiSoft.c [LOG] s:on_text_document_did_open() 3 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/%5BWilder%20Popup%200%5D
2022 5月 26 02时14分07秒 devAiSoft.c [LOG] s:on_text_document_did_open() 2 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/-MINIMAP-
2022 5月 26 02时14分07秒 devAiSoft.c [ERR] {"response":{"data":{"path":"file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c","__data__":"vim-lsp","server_name":"clangd"},"message":"not dirty"}}
2022 5月 26 02时14分07秒 devAiSoft.c [LOG] {"response":{"data":{"__data__":"vim-lsp","server_name":"clangd"},"message":"configuration sent"}}
2022 5月 26 02时14分07秒 devAiSoft.c [LOG] s:on_text_document_did_open() 1 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c
2022 5月 26 02时14分07秒 devAiSoft.c [LOG] Easycomplete Startup /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/\[Wilder\ Popup\ 1]
2022 5月 26 02时14分07秒 devAiSoft.c [LOG] s:on_text_document_did_open() 3 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/%5BWilder%20Popup%200%5D
2022 5月 26 02时14分07秒 devAiSoft.c [LOG] s:on_text_document_did_open() 2 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/-MINIMAP-
2022 5月 26 02时14分07秒 devAiSoft.c [ERR] {"response":{"data":{"path":"file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c","__data__":"vim-lsp","server_name":"clangd"},"message":"not dirty"}}
2022 5月 26 02时14分07秒 devAiSoft.c [LOG] {"response":{"data":{"__data__":"vim-lsp","server_name":"clangd"},"message":"configuration sent"}}
2022 5月 26 02时14分07秒 devAiSoft.c [LOG] s:on_text_document_did_open() 1 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c
2022 5月 26 02时14分07秒 devAiSoft.c [LOG] Easycomplete Startup /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/\[Wilder\ Popup\ 0]
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [ERR] notification <---(stderr) 6 clangd ["I[02:14:11.523] Debian clangd version 13.0.1-4","I[02:14:11.523] Features: linux+grpc","I[02:14:11.523] PID: 337624","I[02:14:11.523] Working directory: /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev","I[02:14:11.523] argv[0]: clangd","I[02:14:11.523] Starting LSP over stdin/stdout","I[02:14:11.523] <-- initialize(1)","I[02:14:11.523] --> reply:initialize(1) 0 ms","I[02:14:11.602] <-- initialized",""]
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [ERR] {"response":{"data":{"path":"file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c","__data__":"vim-lsp","server_name":"clangd"},"message":"not dirty"}}
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] notification ---> 6 clangd
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] s:update_file_content() 5
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] {"response":{"data":{"__data__":"vim-lsp","server_name":"clangd"},"message":"configuration sent"}}
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] notification ---> 6 clangd
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] lsp response <--- 6 clangd
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] {"response":{"data":{"__data__":"vim-lsp","lsp_id":6,"server_name":"clangd"},"message":"started lsp server successfully"}}
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] Starting server clangd ["clangd"]
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] s:on_text_document_did_open() 5 c /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] s:on_text_document_did_open() 4 c /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/%5BWilder%20Popup%201%5D
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] s:on_text_document_did_open() 3 c /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/%5BWilder%20Popup%200%5D
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] s:on_text_document_did_open() 2 c /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/-MINIMAP-
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] easycomplete#lsp#register_server server registered clangd
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] lsp#register_server server already registered clangd
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] Easycomplete Startup /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] s:on_text_document_did_close() 1
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [ERR] notification <---(stderr) 6 clangd ["I[02:14:11.603] <-- textDocument/didOpen","I[02:14:11.604] Failed to find compilation database for /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c","I[02:14:11.604] ASTWorker building file /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c version 1 with command clangd fallback","[/home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db]","/usr/bin/clang -resource-dir=/usr/lib/llvm-13/lib/clang/13.0.1 -- /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c",""]
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [ERR] notification <---(stderr) 6 clangd ["I[02:14:11.714] --> textDocument/publishDiagnostics",""]
2022 5月 26 02时14分11秒 /home/zhangzhao/Lab/epics_base/base-3.15.5/src/ioc/db/dbLink.c [LOG] lsp response <--- 6 clangd
2022 5月 26 02时14分12秒 devAiSoft.c [ERR] notification <---(stderr) 6 clangd ["I[02:14:12.851] <-- textDocument/didOpen","I[02:14:12.852] Failed to find compilation database for /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c","I[02:14:12.852] ASTWorker building file /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c version 1 with command clangd fallback","[/home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev]","/usr/bin/clang -resource-dir=/usr/lib/llvm-13/lib/clang/13.0.1 -- /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c",""]
2022 5月 26 02时14分12秒 devAiSoft.c [ERR] {"response":{"data":{"path":"file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c","__data__":"vim-lsp","server_name":"clangd"},"message":"not dirty"}}
2022 5月 26 02时14分12秒 devAiSoft.c [LOG] notification ---> 6 clangd
2022 5月 26 02时14分12秒 devAiSoft.c [LOG] s:update_file_content() 1
2022 5月 26 02时14分12秒 devAiSoft.c [LOG] {"response":{"data":{"__data__":"vim-lsp","server_name":"clangd"},"message":"configuration sent"}}
2022 5月 26 02时14分12秒 devAiSoft.c [LOG] s:on_text_document_did_open() 1 c /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c
2022 5月 26 02时14分12秒 devAiSoft.c [LOG] s:on_text_document_did_close() 5
2022 5月 26 02时14分12秒 devAiSoft.c [ERR] notification <---(stderr) 6 clangd ["I[02:14:12.908] --> textDocument/publishDiagnostics",""]
2022 5月 26 02时14分12秒 devAiSoft.c [LOG] lsp response <--- 6 clangd
2022 5月 26 02时14分13秒 devAiSoft.c [LOG] s:on_text_document_did_close() 1
2022 5月 26 02时14分16秒 devAiSoft.c [ERR] notification <---(stderr) 6 clangd ["I[02:14:16.209] <-- textDocument/didChange","I[02:14:16.211] <-- textDocument/definition(2)","I[02:14:16.211] Failed to find compilation database for /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c","I[02:14:16.211] ASTWorker building file /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c version 2 with command clangd fallback","[/home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev]","/usr/bin/clang -resource-dir=/usr/lib/llvm-13/lib/clang/13.0.1 -- /home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c","I[02:14:16.212] --> reply:textDocument/definition(2) 1 ms",""]
2022 5月 26 02时14分16秒 devAiSoft.c [LOG] lsp response <--- 6 clangd
2022 5月 26 02时14分16秒 devAiSoft.c [LOG] notification ---> 6 clangd
2022 5月 26 02时14分16秒 devAiSoft.c [LOG] {"response":{"data":{"__data__":"vim-lsp","server_name":"clangd"},"message":"configuration sent"}}
2022 5月 26 02时14分19秒 devAiSoft.c [ERR] notification <---(stderr) 6 clangd ["I[02:14:19.161] <-- textDocument/definition(3)","I[02:14:19.161] --> reply:textDocument/definition(3) 0 ms",""]
2022 5月 26 02时14分19秒 devAiSoft.c [LOG] lsp response <--- 6 clangd
2022 5月 26 02时14分19秒 devAiSoft.c [ERR] {"response":{"data":{"path":"file:///home/zhangzhao/Lab/epics_base/base-3.15.5/src/std/dev/devAiSoft.c","__data__":"vim-lsp","server_name":"clangd"},"message":"not dirty"}}
2022 5月 26 02时14分19秒 devAiSoft.c [LOG] {"response":{"data":{"__data__":"vim-lsp","server_name":"clangd"},"message":"configuration sent"}}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the repeated navigation from the C files mentioned in the report, especially devAiSoft.c and dbLink.c, using clangd and both :EasyCompleteGotoDefinition and Ctrl-]. Start by tracing those command and mapping entry points through the EasyComplete LSP navigation flow. Done means definition lookup works repeatedly after returning to the original location and Ctrl-] no longer reports “No defination found” when a definition exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, vim
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.