Skip to content

Commit

Permalink
Make module attributes searchable without leading @
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jul 8, 2024
1 parent adb0971 commit 674b72f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion assets/js/search-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function b64decode (str) {
}

function indexStorageKey () {
return `idv4:${getProjectNameAndVersion()}`
return `idv5:${getProjectNameAndVersion()}`
}

function createIndex () {
Expand Down Expand Up @@ -183,6 +183,11 @@ function docTokenFunction (token) {
}

toSplitWords = parts[parts.length - 1]
} else if (toSplitWords.startsWith("@")) {
// If we have a module attribute, such as @foo_bar,
// also make it searchable as foo_bar
toSplitWords = toSplitWords.substring(1);
tokens.push(token.clone().update(() => toSplitWords))
}

// Now split the function name (or the token, if that's all we had),
Expand Down

Large diffs are not rendered by default.

0 comments on commit 674b72f

Please sign in to comment.