r/ZedEditor • u/Intrepid-Ad-2306 • 1d ago
sorting code elements (functions, classes, etc)
i have looked but haven't found anything that does this. i'm not sure if i'm prepared to put the effort into writing it myself as an extension but i'm curious if anyone has already done it before i seriously consider doing it.
i frequently work on projects with a large amount of small functions, likely a common situation in development. often thousands or tens of thousands of them, separated into files depending on their purpose (a file for filesystem access, a file for authentication, a file for password recovery, etc). from an organizational perspective, it would be good to have a way to sort these functions to make them easier to find quickly. yes, you can certainly use the navigation to find a particular function but it would be easier if, for example, you could just sort them alphabetically.
i currently do that by running a shell script but it's messy and put together in a rush years ago. not to mention not nearly as convenient as being able to do it from within the editor instead of having to use a terminal.
i'm not sure if there's anything out there written to sort functions, classes, etc in various languages. i work primarily with php and javascript so those are the two i'm particularly interested in if it exists.
1
u/Greenforest_27 23h ago
Tree-sitter?
1
u/freefallfreddy 9h ago
I don't understand the question: you want to have an alphabetical list of all symbols (functions and classes) in a project? But then what: you're gonna scroll through thousands of them? Unlikely. So then it's search: https://zed.dev/docs/finding-navigating#go-to-symbol