11

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

rugk
  • 4,755
  • 2
  • 28
  • 55
JacketPotatoeFan
  • 285
  • 3
  • 12

1 Answers1

12

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.
Tulir
  • 878
  • 11
  • 20