Skip to content

Conversation

@IlyasLebleu
Copy link
Contributor

Adds an option for searching warning templates through aliases, for users unsure about the exact name of the template. For example, typing "llm" in the search field returns the {{uw-ai}} template series.

Currently only used for {{uw-ai}}, although written such that other aliases can easily be added if needed.

@siddharthvp
Copy link
Member

I like the idea. It's worth checking though if the feature could be implemented more concisely by building upon the existing Morebits/select2 matchers instead of doing it from scratch.

@IlyasLebleu
Copy link
Contributor Author

@siddharthvp Good idea! Currently, the matcher used by Twinkle is a custom function that runs on top of the existing Select2 default matcher, as it needs to return all existing children of a matched object. My code modifies the default matcher in order to do both at once (plus the alias functionality) – I'm not sure if that is doable with Select2 alone, but it would be great if possible, especially if you already have any matchers in mind.

I'll take a look at the lint errors today!

@NovemLinguae
Copy link
Member

You just need to fix the errors. You can ignore the warnings. Although the "use let or const instead of var" warning might be worth fixing too.

  1438:24  error    'itemProperties' is not defined                                                    no-undef
  1438:52  error    'itemProperties' is not defined                                                    no-undef
  1439:5   error    'elem' is not defined                                                              no-undef
  1439:37  error    'itemProperties' is not defined                                                    no-undef
  1439:65  error    'itemProperties' is not defined                                                    no-undef
  1582:17  error    Strings must use singlequote                                                       quotes
  1584:1   error    Mixed spaces and tabs                                                              no-mixed-spaces-and-tabs
  1588:22  error    Use `.includes()`, rather than `.indexOf()`, when checking for existence           unicorn/prefer-includes
  1588:50  error    Use `.includes()`, rather than `.indexOf()`, when checking for existence           unicorn/prefer-includes
  1595:21  error    Expected '===' and instead saw '=='                                                eqeqeq
  1596:4   error    Mixed spaces and tabs                                                              no-mixed-spaces-and-tabs
  1612:8   error    Mixed spaces and tabs                                                              no-mixed-spaces-and-tabs
  1614:10  error    Mixed spaces and tabs                                                              no-mixed-spaces-and-tabs
  1616:10  error    Mixed spaces and tabs                                                              no-mixed-spaces-and-tabs
  1617:10  error    Mixed spaces and tabs                                                              no-mixed-spaces-and-tabs
  1617:24  error    Expected '===' and instead saw '=='                                                eqeqeq
  1618:12  error    Mixed spaces and tabs                                                              no-mixed-spaces-and-tabs
  1619:10  error    Mixed spaces and tabs                                                              no-mixed-spaces-and-tabs
  1624:10  error    Mixed spaces and tabs                                                              no-mixed-spaces-and-tabs

Copy link
Member

@NovemLinguae NovemLinguae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch breaks the warn -> select2 element in manual testing. Makes it fall back to a regular dropdown. Please fix :)

image image

@IlyasLebleu
Copy link
Contributor Author

Looking at it asap, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants