-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Goto anything quick panel list backend bits [$30] #122
Comments
Also useful: An event callback when the text input has changed with the ability to provide a different list (in case of |
@FichteFoll If I remember correctly, doesn't Sublime Text use the stuff preceding the @/# to filter down the results by searching that specific file? I seem to recall something like |
@ryanwersal Yeah, it lets you do that. When you type |
This is correct. |
I had completely forgotten about the I imagine also that the fuzzy filtering is just about poking the underlying data model without other bits being aware of that that's what's going on, or worded differently everything else just knows that the model changed and queries it for the new info. For the
|
In terms of the fuzzy searching, I've got a go implementation of textmate's fuzzy searching algorithm on my fork. I'll make a pull-request when it's ready. https://github.com/jacobgardner/lime/blob/master/backend/util/fuzzy.go I wrote a python implementation a while back based off of textmate 2's code and compared the output to that and it appears to be identical. Seeing as this is my first go program. It's probably awful go, but it works. If you glance at the code here's the relevant stuff that'll be returned from rank_word(input, word): input is whatever the user typed into the quick bar. Word is typically a file path. The returned value is a score bound between 0 and 1. Where values closer to 1 indicate that the inputted word more closely resembles the path. Typical usage would be running rank_word against all the paths in the project folders/open in views, sorting them descending by their returned rank and that gives you the same functionality as in sublime_text/textmate. The matrix returned gives you the letters that should be bolded in word to show the user where the matches occurred at. Anyway, yes. I'll try to get that pull request done by the end of the week and then start looking at what else I can do. |
Is this a port over from Textmate's source code? Textmate is GPL so I would not be able to accept this code if that is the case. Or is it a known published algorithm? If so, which one? Please provide links to references. Once we know if the code can be accepted or not: in_word should be strings.ContainsRune. Please insert brief comments about what the various for loops in rank_word do. How does the algorithm compare to the naive approach of using regexp.FindStringSubmatchIndex where the regular expression is created by inserting And finally (for now ;)), please create a test to ensure it is functioning as expected. |
Whoops. Yes it's based off of GPLed code. Nice catch. I'll still probably make the changes you suggested to get me used to go patterns. I'll look into writing another fuzzy rank algorithm though. I'll check to see what's out there, but Ialso have a few ideas of my own. Sent from my HTC ----- Reply message ----- Is this a port over from Textmate's source code? Textmate is GPL so I would not be able to accept this code if that is the case. Or is it a known published algorithm? If so, which one? Please provide links to references. Once we know if the code can be accepted or not: in_word should be strings.ContainsRune. is_uppercase should be unicode.IsUpper. is_letter should be unicode.IsLetter. is_digit should be unicode.IsDigit. Please insert brief comments about what the various for loops in rank_word do. Please format the code by running go fmt. How does the algorithm compare to the naive approach of using regexp.FindStringSubmatchIndex where the regular expression is created by inserting .*? between characters in the input string? Please create two benchmark functions comparing the two. And finally (for now ;)), please create a test to ensure it is functioning as expected. — |
https://github.com/mattn/gof might be useful |
I wrote a fuzzy search implementation based on a trie data structure that could potentially be used towards this: https://github.com/Dparker1990/trie. |
@quarnster regarding this issue - have you taken a look at https://github.com/derekparker/trie? Each list item could be stored in the trie data structure, and searched with efficient prefix or fuzzy searching. The data structure also allows for arbitrary metadata to be stored alongside each list item, and the title could be the key. The structure has efficient storage and search properties, and population of the structure is efficient as well. Usage of this package would adhere to the above requirements, and would easily satisfy a callback API - imagine performing a fuzzy search with |
@derekparker Haven't thought about this issue in quite a while but looks like your package would indeed be useful. Thanks for the pointer |
@quarnster cool, I can try and work on a patch for this during the week. I've been absent from this project for a while busy with some other things but I'd like to get back into helping out, I really like this project. |
@derekparker Glad to hear it, all help is highly appreciated. BTW haven't had a chance to look at delve yet but looking forward to it when it works on OSX and I'm in need of some Go debugging in the future :) |
@derekparker Semi-related: delve would be an ideal use case in figuring out where the standard Sublime Text plugin API lacks with regards to creating custom UI elements and how we can improve upon that. But we should probably have that discussion in a separate issue number. |
@quarnster cool I'd love to discuss that more. Delve should be available on OS X soon! |
Moved to limetext/backend#105. |
I've not been thinking about how to implement this at all so it's pretty open. This issue number deals just with the backend management of the quick panel list, not actually filling the list in with content which are dealt with in other issues marked with the goto label.
Rather than someone jumping straight in and implementing it with a pull request, I think it'd be wise to brainstorm a bit to draft up the interfaces involved with the different modes possible for the goto anything functionality.
Did you help close this issue? Go claim the $30 bounty on Bountysource.
The text was updated successfully, but these errors were encountered: