diff --git a/core b/core index e3a99ed..e23e8cd 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit e3a99edc7eab99866928055e689d044e2931276c +Subproject commit e23e8cd9e1040b6cc70862e7fb42648a088ddecb diff --git a/extension/command/help.js b/extension/command/help.js index 791efbd..90cdeea 100644 --- a/extension/command/help.js +++ b/extension/command/help.js @@ -1,4 +1,3 @@ -import { c } from "../core/index.js"; import Command from "../core/command/base.js"; export default class HelpCommand extends Command { diff --git a/extension/command/label.js b/extension/command/label.js index 1ad2ab3..a280bc6 100644 --- a/extension/command/label.js +++ b/extension/command/label.js @@ -1,4 +1,4 @@ -import { c } from "../core/index.js"; +import { Compat } from "../core/index.js"; import Command from "../core/command/base.js"; export default class LabelCommand extends Command { @@ -31,7 +31,7 @@ export default class LabelCommand extends Command { return results.map(label => { return { content: `https://github.com/rust-lang/rust/labels/${label.name}`, - description: `${label.name} - ${c.escape(label.description)}` + description: `${label.name} - ${Compat.escape(label.description)}` } }); } diff --git a/extension/command/rfc.js b/extension/command/rfc.js index 3de2947..afff82d 100644 --- a/extension/command/rfc.js +++ b/extension/command/rfc.js @@ -1,4 +1,4 @@ -import { c } from "../core/index.js"; +import { Compat } from "../core/index.js"; import Command from "../core/command/base.js"; export default class RfcCommand extends Command { @@ -34,7 +34,7 @@ export default class RfcCommand extends Command { }); } return results.map(rfc => { - let title = rfc.title ? `- ${c.escape(rfc.title)}` : `${c.escape(rfc.title)}`; + let title = rfc.title ? `- ${Compat.escape(rfc.title)}` : `${Compat.escape(rfc.title)}`; return { content: `https://www.ncameron.org/rfcs/${String(rfc.number).padStart(4, '0')}.html`, description: `RFC ${rfc.number}: ${rfc.name} ${rfc.date} ${title}` diff --git a/extension/command/rustc.js b/extension/command/rustc.js index 3362569..db58503 100644 --- a/extension/command/rustc.js +++ b/extension/command/rustc.js @@ -1,4 +1,3 @@ -import { c } from "../core/index.js"; import Command from "../core/command/base.js"; export default class RustcCommand extends Command { diff --git a/extension/command/stable.js b/extension/command/stable.js index 785ecc3..c6a9117 100644 --- a/extension/command/stable.js +++ b/extension/command/stable.js @@ -1,4 +1,4 @@ -import { c } from "../core/index.js"; +import { Compat } from "../core/index.js"; import Command from "../core/command/base.js"; import { getScheduledVersions } from "../rust-version.js"; @@ -9,7 +9,7 @@ export default class StableCommand extends Command { async onExecute(arg) { let versions = getScheduledVersions(100) - .map(version => `Version ${version.number} scheduled release on ${c.normalizeDate(version.date)}`) + .map(version => `Version ${version.number} scheduled release on ${Compat.normalizeDate(version.date)}`) return this.wrap(versions); } }; \ No newline at end of file diff --git a/extension/command/target.js b/extension/command/target.js index 38146af..616d20a 100644 --- a/extension/command/target.js +++ b/extension/command/target.js @@ -1,4 +1,4 @@ -import { c } from "../core/index.js"; +import { Compat } from "../core/index.js"; import Command from "../core/command/base.js"; export default class TargetCommand extends Command { @@ -23,7 +23,7 @@ export default class TargetCommand extends Command { .map(target => { return { content: target.url, - description: `${c.capitalize(target.tier)}: ${target.name} - ${target.description}`, + description: `${Compat.capitalize(target.tier)}: ${target.name} - ${target.description}`, }; }); } diff --git a/extension/firefox-bg.html b/extension/firefox-bg.html index bcae9d2..8867838 100644 --- a/extension/firefox-bg.html +++ b/extension/firefox-bg.html @@ -1 +1,10 @@ - + + + + + Rust Search Extension + + + + + diff --git a/extension/main.js b/extension/main.js index 70feb63..d0a9130 100644 --- a/extension/main.js +++ b/extension/main.js @@ -22,7 +22,7 @@ import OpenCommand from "./core/command/open.js"; import HistoryCommand from "./core/command/history.js"; import CommandManager from "./core/command/manager.js"; import CrateDocManager from "./crate-manager.js"; -import { Omnibox, c } from "./core/index.js"; +import { Omnibox, Compat } from "./core/index.js"; const INDEX_UPDATE_URL = "https://rust.extension.sh/update"; const RUST_RELEASE_README_URL = "https://github.com/rust-lang/rust/blob/master/RELEASES.md"; @@ -39,7 +39,7 @@ function getPlatformOs() { async function start(el, placeholder) { const defaultSuggestion = `Search std docs, external docs (~,@), crates (!), attributes (#), books (%), clippy lints (>), and error codes, etc in your address bar instantly!`; - const omnibox = new Omnibox({ el, defaultSuggestion: placeholder || defaultSuggestion, maxSuggestionSize: c.omniboxPageSize() }); + const omnibox = new Omnibox({ el, defaultSuggestion: placeholder || defaultSuggestion, maxSuggestionSize: Compat.omniboxPageSize() }); // All dynamic setting items. Those items will been updated // in chrome.storage.onchange listener callback. @@ -118,7 +118,7 @@ async function start(el, placeholder) { let description = doc.displayPath + `${doc.name}`; if (doc.desc) { - description += ` - ${c.escape(c.eliminateTags(doc.desc))}`; + description += ` - ${Compat.escape(Compat.eliminateTags(doc.desc))}`; } if (doc.queryType === "s" || doc.queryType === "src") { @@ -246,7 +246,7 @@ async function start(el, placeholder) { let content = `@${item.name}`; return { content, - description: `${content} v${item.version} - ${c.escape(c.eliminateTags(item.doc))}`, + description: `${content} v${item.version} - ${Compat.escape(Compat.eliminateTags(item.doc))}`, }; } }, @@ -279,7 +279,7 @@ async function start(el, placeholder) { onFormat: (index, crate) => { return { content: `https://docs.rs/${crate.id}`, - description: `${c.capitalize("docs.rs")}: ${crate.id} v${crate.version} - ${c.escape(c.eliminateTags(crate.description))}`, + description: `${Compat.capitalize("docs.rs")}: ${crate.id} v${crate.version} - ${Compat.escape(Compat.eliminateTags(crate.description))}`, }; }, onAppend: (query) => { @@ -298,7 +298,7 @@ async function start(el, placeholder) { onFormat: (index, crate) => { return { content: `https://${crateRegistry}/crates/${crate.id}`, - description: `${c.capitalize(crateRegistry)}: ${crate.id} v${crate.version} - ${c.escape(c.eliminateTags(crate.description))}`, + description: `${Compat.capitalize(crateRegistry)}: ${crate.id} v${crate.version} - ${Compat.escape(Compat.eliminateTags(crate.description))}`, }; }, onAppend: (query) => { @@ -318,7 +318,7 @@ async function start(el, placeholder) { onFormat: (index, crate) => { return { content: `${REDIRECT_URL}?crate=${crate.id}`, - description: `${c.capitalize("repository")}: ${crate.id} v${crate.version} - ${c.escape(c.eliminateTags(crate.description))}`, + description: `${Compat.capitalize("repository")}: ${crate.id} v${crate.version} - ${Compat.escape(Compat.eliminateTags(crate.description))}`, }; }, onAppend: (query) => { @@ -342,7 +342,7 @@ async function start(el, placeholder) { onFormat: (index, attribute) => { return { content: attribute.href, - description: `Attribute: #[${attribute.name}] ${c.escape(attribute.description)}`, + description: `Attribute: #[${attribute.name}] ${Compat.escape(attribute.description)}`, }; }, }); @@ -354,7 +354,7 @@ async function start(el, placeholder) { onFormat: (index, feat, query) => { return { content: `https://caniuse.rs/features/${feat.slug}`, - description: `Can I use: ${c.escape(feat.match)} [${feat.version}] - ${c.escape(feat.description)}` + description: `Can I use: ${Compat.escape(feat.match)} [${feat.version}] - ${Compat.escape(feat.description)}` }; }, onAppend: () => { @@ -392,7 +392,7 @@ async function start(el, placeholder) { let parentTitles = page.parentTitles || []; return { content: page.url, - description: `${[...parentTitles.map(t => c.escape(t)), `${c.escape(page.title)}`].join(" > ")} - ${page.name}` + description: `${[...parentTitles.map(t => Compat.escape(t)), `${Compat.escape(page.title)}`].join(" > ")} - ${page.name}` } }, onAppend: () => { @@ -411,7 +411,7 @@ async function start(el, placeholder) { onFormat: (_, lint) => { return { content: `${LINT_URL}#${lint.name}`, - description: `Clippy lint: [${lint.level}] ${lint.name} - ${c.escape(c.eliminateTags(lint.description))}`, + description: `Clippy lint: [${lint.level}] ${lint.name} - ${Compat.escape(Compat.eliminateTags(lint.description))}`, } }, }); diff --git a/extension/search/docs/crate-doc.js b/extension/search/docs/crate-doc.js index 7b803dd..f1d98bf 100644 --- a/extension/search/docs/crate-doc.js +++ b/extension/search/docs/crate-doc.js @@ -1,4 +1,3 @@ -import { c } from "../../core/index.js"; import DocSearch from "./base.js"; import CrateDocManager from "../../crate-manager.js"; import settings from "../../settings.js";