brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

[CLOSED] add fuzzy code hint searching #6705

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by JeffryBooher Monday Apr 07, 2014 at 23:09 GMT Originally opened as https://github.com/adobe/brackets/pull/7441


Adds fuzzy code hints to css editing:

Known issues:

shape-inside: circle( <-- presents shapes again. This exists in master because we don't set the context o


JeffryBooher included the following code: https://github.com/adobe/brackets/pull/7441/commits

core-ai-bot commented 3 years ago

Comment by dangoor Monday Apr 14, 2014 at 20:06 GMT


Initial review done.

core-ai-bot commented 3 years ago

Comment by JeffryBooher Tuesday Apr 22, 2014 at 19:59 GMT


@dangoor All feedback addressed ready to re-review.

core-ai-bot commented 3 years ago

Comment by dangoor Wednesday Apr 23, 2014 at 19:41 GMT


Hey@JeffryBooher, wow... small code change!

Unfortunately, I think a bit more code change is required, though:

  1. Trying this out, the results are not ideal. Using the example from #5445, typing "ml" returns all sorts of stuff but margin-left is hiding way down there because the results are being sorted alphabetically. StringMatch returns too many results to be useful with an alpha sort. There's a function called basicMatchSort in StringMatch that you'd want to use to get results based on the StringMatch scoring. I'm guessing that using the match sort typing "ml" will put "margin-left" at the top.
  2. There are 3 unit test failures for this extension on this branch.
core-ai-bot commented 3 years ago

Comment by JeffryBooher Thursday Apr 24, 2014 at 00:31 GMT


@dangoor basicStringMatch didn't do it. I'm going to have to write a custom sorter which i had thought about doing anyway.

core-ai-bot commented 3 years ago

Comment by JeffryBooher Thursday Apr 24, 2014 at 00:39 GMT


It looks like jsCodeHints makes its own sort functor to callback with

penalizeUnderscoreValueCompare()

We could do something similar to that in CSS code hints

but we first want the needle to match

'ba' (background-*) matches first and (background-attachement) is the first item in the list.

This may be difficult to do with a callback since we need the needle as well...

core-ai-bot commented 3 years ago

Comment by dangoor Thursday Apr 24, 2014 at 01:15 GMT


@JeffryBooher The stringMatch function returns a value with a "matchGoodness" score. You need to hang on to that value for all of the matches and then sort on that. The penalizeUnderscoreValueCompare is just there in JS code hints to prefer public API values to private ones. JS code hints is doing what the basicMatchSort does but customized a little bit to handle the stack depth of the match and the underscores.

core-ai-bot commented 3 years ago

Comment by JeffryBooher Thursday Apr 24, 2014 at 17:04 GMT


@dangoor Tests fixed and fuzzyMatching should be on par with what's expected:

"b-l-c" will get you "border-left-color" as the only option. "ml" will yield a list with "margin-left" at the top.

core-ai-bot commented 3 years ago

Comment by dangoor Thursday Apr 24, 2014 at 17:57 GMT


@JeffryBooher Works great!

The code duplication seems borderline for refactoring to eliminate the duplication, but I think it's small enough that this is fine.

I'll go ahead and merge. Thanks for the nice addition!

core-ai-bot commented 3 years ago

Comment by humphd Monday May 11, 2015 at 23:19 GMT


One of the commits in this introduced a regression, see #11088.