RJ
RJβ€’2w ago

Fuzzy search for function names in functions panel

Would be nice πŸ™‚ I also always assume that it works like this and only remember after my fuzzy query fails.
26 Replies
Convex Bot
Convex Botβ€’2w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
ari
ariβ€’2w ago
Thanks for the suggestion! Can you share an example or two of what string you'd want to match which functions, and by what criteria?
RJ
RJOPβ€’2w ago
1. I have a lot of functions that are namespaced/nested in folders, like this: namespaceOne/namespaceTwo/fileOne:myFunction. They may even have similar names, such that (for example) there's another function like this: namespaceThree/namespaceFour/fileTwo:myFunction. So it's easier for me to pull up the exact function I'm looking for if I can first type something like namespaceThree followed by myFunction, for a final query that looks like namespaceThreemyFunction 2. Sometimes I don't remember the name of the exact function I'm looking for, but I remember which, say, top-level namespace it's in. In this case it's helpful to start by typing the name of that namespace, and then to try out different terms from there (to effectively search within that namespace).
ballingt
ballingtβ€’2w ago
Would it be fair to say you want the behavior of VSCode's cmd-p, or fzf's ctrl-p?
ari
ariβ€’2w ago
Thanks! Yeah this is what i'd want too, similar to how search works with CmdP in vscode
ballingt
ballingtβ€’2w ago
jinx
ari
ariβ€’2w ago
Tom, wanna rock paper scissors for who gets to build this? πŸ˜›
ballingt
ballingtβ€’2w ago
I'm already shopping for npm libraries
ari
ariβ€’2w ago
fuzzy seems like it accomplishes this and is pretty popular, also reasonable bundle size (https://bundlephobia.com/package/fuzzy@0.1.3)
fuzzy v0.1.3 ❘ Bundlephobia
Find the size of javascript package fuzzy v0.1.3. Bundlephobia helps you find the performance impact of npm packages.
RJ
RJOPβ€’2w ago
yes that is exactly what I want πŸ˜„
ballingt
ballingtβ€’2w ago
https://github.com/farzher/fuzzysort looks good too for directory path-link items like we have
GitHub
GitHub - farzher/fuzzysort: Fast SublimeText-like fuzzy search for ...
Fast SublimeText-like fuzzy search for JavaScript. - farzher/fuzzysort
ari
ariβ€’2w ago
ha, i thought the fuzzy package would implement edit-distance or something, but it's looping through strings comparing each character, adding matches. makes sense too and is simpler https://github.com/mattyork/fuzzy/blob/master/lib/fuzzy.js#L57-L70
GitHub
fuzzy/lib/fuzzy.js at master Β· mattyork/fuzzy
Filters a list based on a fuzzy string search. Contribute to mattyork/fuzzy development by creating an account on GitHub.
ari
ariβ€’2w ago
Hmm, what's the difference between the two tom? Also I just remembered we also match on the source code of functions. I wonder if we should just remove that functionality because it's not super standard and we probably search entire modules which means false positives
ballingt
ballingtβ€’2w ago
fuzzysort seems to do some heuristics like "the letters you typed are probably at the beginning of path components that you're looking for https://rawgit.com/farzher/fuzzysort/master/test/test.html
ballingt
ballingtβ€’2w ago
before it falls back to "yeah those letters are in there in order"
No description
ballingt
ballingtβ€’2w ago
7.5kB though, hard to argue with that elegant for loop
ari
ariβ€’2w ago
hehe yeah this looks cool but i'd personally lean towards something simpler / more easily explainable. no strong preference. Anyway, RJ, apologies for nerding out in here. One of us will likely ship this feature request this week πŸ™‚
RJ
RJOPβ€’2w ago
Haha don't apologize, looking forward to it!
ari
ariβ€’2w ago
@RJ it's out
RJ
RJOPβ€’2w ago
It works beautifully, but I realize now I wasn't clear enough about where precisely my desire for this aroseβ€”I was referring to the "Run functions" pop-out panel, not the page/tab
No description
RJ
RJOPβ€’2w ago
Sorry πŸ€¦β€β™‚οΈ
ari
ariβ€’2w ago
ah lol, i thought you meant for the file directory! yeah we can do that there too, stay tuned
ari
ariβ€’2w ago
New version shipped
RJ
RJOPβ€’2w ago
I’ve already gotten use out of it! Thank you! Makes a big difference