Need to Add Debugger into PyCharm Plugin
Hello Team,
We need help in PyCharm Plugin Development.
We are developing a PyCharm plugin designed to generate Python code as output based on specific input. The provided code serves as a Python template that users can modify before running it through our PyCharm plugin. The user interface of our PyCharm plugin will resemble the following:
After clicking on run button we can able to run respected python function. We use custom RunConfigurationOptions class which have “python script name” as input and we run that commands on console.
Running above configuration on console.
Issue Description: Our objective is to integrate the PyCharm debugger into Python code generated by our plugin. In the current setup, we are utilizing a custom run configuration to execute commands in the console. However, we are facing a challenge in incorporating the debugger. We are exploring the option of leveraging the existing Python Run Configuration in PyCharm, which already possesses debugger functionality. Unfortunately, we have been unable to locate any references for the built-in Python Run Configuration classes. Your assistance in identifying these classes or offering guidance on how to integrate the debugger into our PyCharm plugin would be greatly appreciated.
Please sign in to leave a comment.
Hello,
I am unsure I understand the issue, so I describe how I see it, and you correct me if I am wrong.
You have a form that takes an input and generates corresponding Python code. Now, you need to run this code under the debugger.
In this case, your "Run" button should be registered as a program executor, and you will also need a program runner that can run this executor ID.
Look at the PyDebugRunner class, which runs a run configuration when you click the "Debug" button. Its `canRun()` method checks the executor ID to verify it can run a given combination of executor and run configuration.
As I mentioned, you can probably register a custom executor and redefine the `canRun()` method in a PyDebugRunner subclass to accept only this executor.
Also, look at the Execution section of the IntelliJ Platform Plugin SDK docs.
I hope this helps.