diff --git a/lib/std/special/docs/main.js b/lib/std/special/docs/main.js index 6afe47361..67ab1de00 100644 --- a/lib/std/special/docs/main.js +++ b/lib/std/special/docs/main.js @@ -595,6 +595,7 @@ } function renderSearch() { var matchedItems = []; + var ignoreCase = (curNavSearch.toLowerCase() === curNavSearch); var terms = curNavSearch.split(/[ \r\n\t]+/); decl_loop: for (var declIndex = 0; declIndex < zigAnalysis.decls.length; declIndex += 1) { @@ -602,21 +603,25 @@ if (canonPath == null) continue; var decl = zigAnalysis.decls[declIndex]; + var lastPkgName = canonPath.pkgNames[canonPath.pkgNames.length - 1]; + var searchText = lastPkgName + "." + canonPath.declNames.join('.'); + var astNode = zigAnalysis.astNodes[decl.src]; + if (astNode.docs != null) { + searchText += "\n" + astNode.docs; + } + var file = zigAnalysis.files[astNode.file]; + searchText += "\n" + file; + if (ignoreCase) { + searchText = searchText.toLowerCase(); + } + for (var termIndex = 0; termIndex < terms.length; termIndex += 1) { var term = terms[termIndex]; - if (decl.name.indexOf(term) >= 0) { + if (searchText.indexOf(term) >= 0) { continue; + } else { + continue decl_loop; } - var astNode = zigAnalysis.astNodes[decl.src]; - if (astNode.docs != null && astNode.docs.indexOf(term) >= 0) { - continue; - } - var file = zigAnalysis.files[astNode.file]; - if (file.indexOf(term) >= 0) { - continue; - } - - continue decl_loop; } matchedItems.push({