universal-ctags/citre

能不能实现精确查找和模糊查找定义

Closed this issue · 6 comments

t6ui commented

现有citre-jump功能只能查找当前光标下或者标记区域的定义。
能不能增加两个命令:

  1. citre-jump-fuzzy 直接列出所有的标签,通过用户输入进行模糊搜索
  2. citre-jump-exactly 先通知用户输入tag字符串,然后精确查找改tag的定义

c-u xref-find-definitions可以进行查找,但是像kernel这样庞大的库,会直接卡住。

精确查找使用的场景有:比如书籍上有一个函数方法,需要立马查找到这个方法的定义,此时可以通过调用citre-jump-exactly来定位到目标tag。如果tag数量非常大,比模糊查找更加好用。

谢谢!


Translate (by @AmaiKinono):

For now, citre-jump could only find definitions of a marked symbol or symbol at point. Could we have 2 more commands?

  • citre-jump-fuzzy: List all tags, and do fuzzy search based on user input.
  • citre-jump-exactly: Query the user for a symbol name and find its tag by precise searching.

c-u xref-find-definitions is able to filter by user input but it stucks on a huge repository like the kernel.

citre-jump-exactly could be used to find a symbol that the user reads from a book (so it's not in the editor). If we have huge amounts of tags, this will perform better than fuzzy search.

Does xref-find-definitions fuzzy-search?
How can I see the "fuzzy-search"?
I have a tag file for the latest kernel. I would like to know a symbol that reproduces the fuzzy-search.

I do have some thoughts in #47, which seems to cover all your needs. I have a very early prototype on my local machine but I haven't find time to work on it.

t6ui commented

@masatake
Using C-u xref-find-definitions combined with vertico and orderless can facilitate fuzzy search. However, if the tag file is too large, this approach becomes impractical.

t6ui commented

@AmaiKinono
Thank you so much!I'm looking forward to seeing this functionality come to life when you have the time to further develop it. Your work is greatly appreciated!

t6ui commented

close this, follow #47

Now we have citre-query-* commands. citre-query-jump is like citre-jump-exactly you've mentioned, and if you call it with a prefix argument, it's like citre-jump-fuzzy.