Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Firefox Web Extensions Development

Am learning how to use the Firefox Web Extensions API, and am using IntelliJ.

IDE: underlined JS: browser.browserAction.onClicked.addListener(() => { browser.tabs.executeScript(…

Is there a way to get code completion / suggestions for the API?

I followed the steps in the answer below, but there doesn't seem to be a complete one for Firefox.

https://stackoverflow.com/a/25466708/5941389

like image 926
JacketPotatoeFan Avatar asked Feb 10 '17 22:02

JacketPotatoeFan


1 Answers

Firefox WebExtension type stubs were added recently (Nov 2017) under the name firefox-webext-browser. The steps in the answer you linked are now valid (relevant changes in bold):

First time setup

  1. Open the Settings dialog (File > Settings)
  2. Click Languages & Frameworks > Javascript > Libraries
  3. Click Download
  4. Make sure TypeScript community stubs is selected
  5. Select firefox-webext-browser from the list (you can find it quickly by just typing firefox-w)
  6. Click Download and Install
  7. Click OK to close the Settings dialog.

In Subsequent Projects

  1. Open the Settings dialog again (File > Settings)
  2. Click Languages & Frameworks > Javascript > Libraries again
  3. Check @types/firefox-webext-browser
  4. Click OK to close the dialog.
like image 148
Tulir Avatar answered Nov 02 '22 17:11

Tulir