Trying to add custom action to Webstorm Floating Code Tool Bar

Hello,
I have a custom action that I have added to the Floating Code Toolbar in the Intellij IDE via the plugin xml:
```

```

And this works perfectly fine in IntelliJ IDEA where the action shows up as expected when I highlight code in my editor.

However, in WebStorm my action doesn’t show up at all. I have tried looking around but I can’t seem to find how to add it to this component. Can someone point me to how I can figure this out/what the component I am looking for is?

Note:
I already tried adding com.intellij.modules.lang
to my plugin.xml as per this stackoverflow post:

Unfortunately, that did not fix it.

1 Like

Hi,
can you provide the source of the plugin.xml declaration? It is missing in the original post.

<group id="my.ID"
        class="my.Class"
        text="My Action Group"
        popup="true">
    <add-to-group group-id="EditorPopupMenu" anchor="first"/>
    <add-to-group group-id="Floating.CodeToolbar" anchor="first"/>
</group>

Sorry about that, seems like I didn’t copy paste it correctly!

In WebStorm, the floating codebar has a different ID. It’s Floating.CodeToolbar.JS.

<add-to-group group-id="Floating.CodeToolbar.JS" anchor="last"/>

To enable this functionality, your plugin needs to <depend> on the JavaScript plugin. Remember to add the JavaScript plugin to the build.gradle.kts as a bundledPlugin. As a special note of caution: JavaScript plugin is not available in the IntelliJ IDEA Community Edition.

Thanks! That worked, I ended up not needing to add the JavaScript plugin to my build.gradle.kts as I declared it as a optional dependency in my plugin.xml with an extra config file and that did the trick!

Indeed, that is even better solution.

Note that without declaring the JavaScript plugin in the build.gradle.kts you might plugin.xml issues about missing or unresolved group ID.