"insert here" the result of an API call
Greetings
I'm using PHPStorm to build sites which includes assets from asset servers.
I was wondering if there would be clever/simple way to implement my workflow:
- when editing a file in PHPStorm, start the tools somehow
- the tool itself could be some kind of bash/whatever I wrote myself
- insert the output of the tool as a string where I was when starting it
The problem I think is that it contains an asynchronous API call (sending a file to a server and getting a public URL back).
What do you think?
Thanks in advance
Regards
Please sign in to leave a comment.
Hi,
At the quick glance, this part can be covered by File Watchers:
https://www.jetbrains.com/help/phpstorm/2023.3/settings-tools-file-watchers.html
Not sure how to deal with this part though.
Probably, IDE Scripting Console may help:
https://www.jetbrains.com/help/phpstorm/ide-scripting-console.html
But it is bit of a tricky way as it is not well documented.
Nah .. This request is more like External Tools / Live Templates functionality to me.
@Greg
https://youtrack.jetbrains.com/issue/IDEA-76371 – there are a few recipes in the comments of how others are doing similar stuff. E.g. call the custom command, get the output and put it into a clipboard. Then, when it finish running, paste the result back manually via standard Ctrl+V. A bit too much IMO, but you can execute such an action via custom shortcut / menu item.
You can also use Live Templates (but have to use the Groovy script for that). A bit different invocation logic but can put the output right in the editor. I have not used any of them (have no need for such stuff) so make sure to check all the comments there.
You can even find 2 plugins mentioned in the last few comments that can help with that.
P.S. The above is how I understood your request.