A handy browser extension to search crates and official docs in address bar (omnibox)


#1

Hi, I’m a Rust developer from China, I’m so excited to share my Chrome extension to help Rustaceans search docs and crates in address bar quickly. Here is the extension project at Github https://github.com/Folyd/rust-search-extension.

I didn’t publish it to Chrome Webstore yet as I think it’s would be better to publish in the name of the Rust team. What do you think, I’d love to transfer the project to the rust-lang-nursery organization. :grinning:

Here is the demonstration gif:


#2

Currently, it only supports search stable version docs, the nightly version will be supported soon.


#3

Very nice! :slight_smile: A few things:

  • I’d like to try it but have no idea how to install it if it’s not on the Chrome Web Store. It would be awesome if you could add a little explanation how to add the extension from GitHub.

  • Feel free to upload it to the Chrome Web Store already. Usually projects need to exist for some time before the rust-lang-nursery accepts them. Many crucial parts of our eco-system are not from the official Rust team and that’s not a problem.

  • Since I didn’t try it yet, this feature might already exist, but it would be awesome to also use the local documentation (rustup docs). Loading local files is still significantly faster than through the internet. Personally, right now, I have several search prefixes for my Chrome. rs searches my local stable documentation, rsw searches the online stable documentation, rsn searches my local nightly documentation, and so on. Would be awesome if your extension would allow for multiple of those search prefixes, too.


#4

Thanks for replying.

Sure, I can publish the extension to Chrome Web Store in the name of myself. If the Rust team accept the project transfer to rust-lang-nursery, we can publish it again in the name of the Rust team and I’ll unpublish my one.

It’s a good idea to search local Rust docs in the address bar, and this is in my development plan.

Unfortunately, there is only one keyword supported for each Chrome extension, but we can add some configuration to support search stable and nightly docs.


#5

Finally, I published to Chrome Web Store. Please click here to install! Thanks!


#6

Could you explain somewhere why the plugin needs the permission it needs? When installing from WebStore, it prompts the permission “Read your browsing history” is required. Which is “scary”. In your manifest.json I see:

  "permissions": [
    "tabs"
  ]

So I have two questions:

  • Why is this permission needed?
  • Why is the description of the permission "tabs" about browsing history?

I guess it’s not your fault, but just an annoying/confusing permission model by Chrome. But I always like it when apps describe somewhere why they need specific permissions.


Oh and I just noticed: this is IRLO, I guess this kind of post fits on URLO much better.


#7

Any plans for a Firefox extension?


#8

That’s very nice. I’m also a Chinese developer and I think you are great.

But why not port the extension to Firefox since the Firefox also has many users. What’s more, Firefox is developed by Mozilla which develops rust-lang:sunglasses:


#9

Hi Lukas, the only permission required by search-rust-extension is tabs, that because we can configure whether open the search result in the current tab or the new tab.

You can find the setting on the popup page.

And here is the concrete code which associated with the tabs permission:

function navigateToUrl(url) {
    function nullOrDefault(value, defaultValue) {
        return value === null ? defaultValue : value;
    }

    var openType = nullOrDefault(localStorage.getItem("open-type"), "current-tab");
    if (openType === "current-tab") {
        chrome.tabs.query({active: true}, function(tab) {
            chrome.tabs.update(tab.id, {url: url});
        });
    } else {
        chrome.tabs.create({url: url});
    }
}

Please don’t worry about the tabs permission usage in my extension, and don’t be scared by Chrome crazy permission description.

That’s why I think it would be safer and more authorized for Rustaceans to using the extension if we transfer the project to rust-lang-nursery and publish it in the name of the Rust team.


#10

@mark-i-m @VitalyAnkh

Yeah, of course, thanks to @pcpthm 's PR, the rust-search-extension is totally Firefox compatible. However, I didn’t publish it to Firefox add-ons store right now, you can install the extension to Firefox manually if you know how to do this. If not please feel free to let me know.

Anyway, in the long term, publishing the extension in the name of myself isn’t a good idea. I hope the Rust team can accept my extension to rust-lang-nursery. :slight_smile: