There is 'arguments' field in Run Configuration editor. So you can create several configurations with different arguments if you need. What kind of arguments are you interested in?
In case of bundled NodeJS plugin (e.g. WebStorm) you can find it in the location like this: /Applications/WebStorm.app/Contents/plugins/NodeJS (example is actual for macos)
Mhh sorry for diggint this out, I have exactly the same problem I located the nodejs.jar but the
NpmRunConfiguration
cannot be found, I added the jar to my deps, but the class is not found. But if I load my run configs which I already have programmatically I see a reference to this class somewhere. Has the class been moved out into another jar?
Thanks a lot. That helps. Just another question, since all this stuff is not really opensource, how can we handle this dependency in an opensource project. Dumping the jars in is probably a no go due to licensing reasons. Is there a way to declare this dependency into this jar via a gradle/maven dependency entry in the build.
First of all your plugin should depend on JavaScript Support: add this line to the plugin.xml:
<depends>JavaScript</depends>
then call RunManager.getInstance(project).getConfigurationType("js.build_tools.npm") to ensure that it really exists.
I'm afraid that plugins (especially ultimate ones) are not designed to be part of API so the dependency between plugins is not so simple and straight, probably you have to use reflection in your open-source code.
Thanks for the clarification, I guess it is then either reflection or maybe even the better way, just drop a shared runtimeConfig xml into the .idea/runConfigurations folder.
Is there anything which would speak against such an approach?
There is 'arguments' field in Run Configuration editor. So you can create several configurations with different arguments if you need. What kind of arguments are you interested in?
@Vassiliy Kudryashov
Yes, in Run Configuration there is field with arguments but I want to run configuration from plugin(code) and specify arguments.
@edit
It could be easier to which part I want to get access:
OK, now I see.
Please try NpmRunConfiguration.setRunSettings(here should be used a new instance, use NpmRunSettings.Builder to create it)
Unfortunately NpmRunConfiguration can not be resolved.
Do I need external libraries?
You need plugins/NodeJS/lib/NodeJS.jar from your plugins location (see https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs) as a library.
In case of bundled NodeJS plugin (e.g. WebStorm) you can find it in the location like this: /Applications/WebStorm.app/Contents/plugins/NodeJS (example is actual for macos)
Mhh sorry for diggint this out, I have exactly the same problem I located the nodejs.jar but the
cannot be found, I added the jar to my deps, but the class is not found. But if I load my run configs which I already have programmatically I see a reference to this class somewhere. Has the class been moved out into another jar?
NpmRunConfiguration.class is located in JavaScriptLanguage.jar and provided by 'JavaScript Support' plugin.
Thanks a lot. That helps. Just another question, since all this stuff is not really opensource, how can we handle this dependency in an opensource project. Dumping the jars in is probably a no go due to licensing reasons. Is there a way to declare this dependency into this jar via a gradle/maven dependency entry in the build.
First of all your plugin should depend on JavaScript Support: add this line to the plugin.xml:
<depends>JavaScript</depends>
then call RunManager.getInstance(project).getConfigurationType("js.build_tools.npm") to ensure that it really exists.
I'm afraid that plugins (especially ultimate ones) are not designed to be part of API so the dependency between plugins is not so simple and straight, probably you have to use reflection in your open-source code.
Thanks for the clarification, I guess it is then either reflection or maybe even the better way, just drop a shared runtimeConfig xml into the .idea/runConfigurations folder.
Is there anything which would speak against such an approach?
At least.. it sounds harmless.