zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.64k stars 2.65k forks source link

Semantic search based on tree-sitter #10621

Open wasd96040501 opened 4 months ago

wasd96040501 commented 4 months ago

Check for existing issues

Describe the feature

Zed is known based on tree-sitter. Is it possible that we can use not only text or regex based search, but also use tree-sitter's query based search? Sometimes we want to do some accurate search especially when repo is very large when text or regex based search is unusable(search result is too much to read).

And it will be more usable if we can make code navigation programmable(and navigation target is provided by tree-sitter query), here is a example.

func main(){
      fmt.Println("hello world")
    //^ cursor is here
}

I want to navigate to next function call(which is P's position). I just need write a small tree-sitter query (call_expression) and register it as a custom command(or something else) and bind it in keymap.

If it is possible, I'm willing to implement this under guidance.

If applicable, add mockups / screenshots to help present your vision of the feature

No response

marcospb19-cw commented 1 month ago

I see two issues in one here: tree-sitter search and semantic tree navigation, both could help, but I'd say they are different features.