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

Options markSearchResults and labelRenderer does not play well together #249

Closed
neonrust opened this issue May 4, 2023 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@neonrust
Copy link
Contributor

neonrust commented May 4, 2023

Having a labelRenderer that adds HTML, causes the markSearchResults feature to mark text maching DOM elements. That is, if you search for something that matches it, e.g. "class", that also happens to match an option.

I looked in the code, and the marking does indeed operate on the label generated by the labelRenderer.

      if (hasLabelRenderer) {
        optionLabel = labelRenderer(d);
      } else {
        optionLabel = d.label;
      }

      if (d.description) {
        description = `<div class="vscomp-option-description" ${optionTooltip}>${d.description}</div>`;
      }

      if (d.isCurrentNew) {
        optionClasses += ' current-new';
        rightSection += newOptionIconHtml;
      } else if (markSearchResults && (!d.isGroupTitle || searchGroup)) {
        optionLabel = optionLabel.replace(searchRegex, '<mark>$1</mark>');
      }
@gnbm
Copy link
Collaborator

gnbm commented May 29, 2023

@neonrust this issue has been fixed in the release v1.0.38. Thanks for the contribution

@gnbm gnbm closed this as completed May 29, 2023
@sa-si-dev sa-si-dev added the bug Something isn't working label Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants