Skip to content
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

[CLOSED] Fix Quick Open so discontiguous matches are highlighted in all modes #1994

Open
core-ai-bot opened this issue Aug 29, 2021 · 6 comments

Comments

@core-ai-bot
Copy link
Member

Issue by peterflynn
Tuesday Nov 06, 2012 at 07:17 GMT
Originally opened as adobe/brackets#2062


This is a follow-up to pull #1470, which added discontiguous matching to Quick Open but only highlights such matches in bold in the default search mode. To make it work in all modes, we:

  • Hoist out generic highlightMatch() utility to generate bolded strings
  • Use it in both defaultResultsFormatter() and _filenameResultsFormatter()
  • Export it so custom result renderers (in extensions) can also use it

Also:

  • Clarify stringMatch() docs a bit
  • Fix an older glitch in basicMatchSort(): the sort field precedence list had a gap, leading to a no-op comparison step

peterflynn included the following code: https://github.com/adobe/brackets/pull/2062/commits

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Tuesday Nov 06, 2012 at 07:20 GMT


@dangoor: no obligation to spend time looking at this, but wanted to give you a heads-up since it's connected to your changes. I'm happy to hear any feedback you might have on this patch.

@core-ai-bot
Copy link
Member Author

Comment by dangoor
Tuesday Nov 06, 2012 at 16:57 GMT


I don't have time to try it out right now, but I took a quick look through the code. I like the way you abstracted the result formatting code so it's now a bit simpler and more flexible.

looks good to me on my scan through. my time is very tight right now, so I couldn't spend a lot of time with it, but nothing popped out as being a bad change from the old behavior.

@core-ai-bot
Copy link
Member Author

Comment by njx
Tuesday Nov 06, 2012 at 21:06 GMT


This looks good, but I found a bug. In QuickOpen.js, do a Cmd-T for "bom". Notice that when it shows boostForMatches, the initial underscore is missing. This doesn't reproduce in master, but it's not clear whether the bug is in the highlighting code or in the original stringMatch() code. (At first I thought it was an edge case in the latter that you'd only hit if the first character was unmatched and the next few were matched, but it looks like there's code to deal with that case.)

@core-ai-bot
Copy link
Member Author

Comment by njx
Tuesday Nov 06, 2012 at 21:17 GMT


Ah, yes, it is an edge case, though not the one I was thinking of. I think the if (strCounter > 0) on line 573 might need to be if (strCounter >= 0).

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Tuesday Nov 06, 2012 at 22:59 GMT


Ah, I see. It repros on master for filenames too, e.g. if you put a leading underscore in the filename. But it's much easier to hit with function names, so this patch makes the bug a lot more prominent... I'll push up a fix.

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Wednesday Nov 07, 2012 at 01:00 GMT


NJ's changes look good -- thanks for the fix! Merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant