mirror of
https://github.com/huhu/rust-search-extension
synced 2024-11-15 16:07:57 +00:00
A new way to register Command
This commit is contained in:
parent
8ba8902caa
commit
45e1edbf82
2 changed files with 5 additions and 3 deletions
|
@ -5,8 +5,9 @@ class HelpCommand extends Command {
|
|||
|
||||
onExecute() {
|
||||
const value = ([
|
||||
`Prefix ${c.match(":")} to execute command (:book, :yet, :stable etc)`,
|
||||
`Prefix ${c.match(":")} to execute command (:book, :yet, :stable, etc)`,
|
||||
`Prefix ${c.match("!")} to search crates, prefix ${c.match("!!")} to search crates's docs url`,
|
||||
`Prefix ${c.match("~")} to search external crate's docs`,
|
||||
`Prefix ${c.match("@crate")} (${c.dim("e.g. @tokio")}) to search that crate's doc exclusively`,
|
||||
`Prefix ${c.match("#")} to search builtin attributes`,
|
||||
`Prefix ${c.match("%")} to search Rust official book chapters`,
|
||||
|
|
|
@ -5,14 +5,15 @@ const bookSearcher = new BookSearch(booksIndex);
|
|||
const lintSearcher = new LintSearch(lintsIndex);
|
||||
const stdSearcher = new StdSearch(searchIndex);
|
||||
const crateDocSearchManager = new CrateDocSearchManager();
|
||||
const commandManager = new CommandManager([
|
||||
const commandManager = new CommandManager(
|
||||
new HelpCommand(),
|
||||
new BookCommand(),
|
||||
new YetCommand(),
|
||||
new StableCommand(),
|
||||
new ToolCommand(),
|
||||
new LabelCommand(labelsIndex),
|
||||
]);
|
||||
new HistoryCommand(),
|
||||
);
|
||||
|
||||
const defaultSuggestion = `Search std ${c.match("docs")}, external ${c.match("docs")} (@), ${c.match("crates")} (!), ${c.match("attributes")} (#), ${c.match("books")} (%), clippy ${c.match("lints")} (>), and ${c.match("error codes")}, etc in your address bar instantly!`;
|
||||
const omnibox = new Omnibox(defaultSuggestion, c.omniboxPageSize());
|
||||
|
|
Loading…
Reference in a new issue