Home > Back-end >  IntelliJ/PhpStorm - How to use IDE scripting engine as a GitHub Copilot completion capture/fix?
IntelliJ/PhpStorm - How to use IDE scripting engine as a GitHub Copilot completion capture/fix?

Time:10-20

I've been trying to find any type of documentation or examples on how to use the "IDE scripting engine" (or other quick methods of enhancing PhpStorm/IntelliJ IDEs) and found literally nothing that works. I'm hoping for a bit of a guideline, maybe a snippet that leads in the right direction.

What I want to do:

  1. When pressing Ctrl Tab (shortcut for GitHub Copilot completion) I want my custom-script to wait for the completion to be inserted into the IDE code.
  2. I want to immediately remove the code again and display it as a completion suggestion (should be quick).
  3. Now I want to press a shortcut to accept the completion word by word until finished.

The possibly biggest problem of Copilot with countless of bug/feedback/feature reports since 2021 is that it inputs tons of code when people just want a tiny part. Like half a line. So users of it are forced to accept 12 lines of bad code, remove all the bad parts.

The reason probably is their marketing, they take those 12 lines (11 of them garbage) as efficiency improvement (12 lines of code accepted). So they don't fix it.

I want to fix it using the above method, the easiest approach would be the most welcome one.

Here is the only available data on the IDE Scripting console: https://www.jetbrains.com/help/idea/ide-scripting-console.html However, none of the examples even worked and there are barely any.

Here are the linked examples: https://gist.github.com/gregsh/b7ef2e4ebbc4c4c11ee9#file-samples-groovy Nothing of that worked either, various errors usually already in the first "imports" and no examples in "javascript"

CodePudding user response:

Here is the finished code, I switched to Kotlin and from the dysfunctional scripting console to "LivePlugin". https://github.com/cmp-nct/Stewardess Stewardess takes over the completions through a new shortcut and plays them in word by word. Also shows the Copilot internal status as temporary hint notification when it changes.

  • Related