universal-ctags / citre

A superior code reading & auto-completion tool with pluggable backends.
GNU General Public License v3.0
320 stars 26 forks source link

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

Closed t6ui closed 3 months ago

t6ui commented 3 months ago

现有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?

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.

masatake commented 3 months ago

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.

AmaiKinono commented 3 months ago

I do have some thoughts in https://github.com/universal-ctags/citre/discussions/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 3 months ago

@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 3 months ago

@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 3 months ago

close this, follow #47

AmaiKinono commented 3 months ago

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.