Can I express in the Script Parameters in run/debug configuration that the file in the active editor should be passed as argument?
已回答
This feature is (was?) present in Eclipse in form of $variables you could specify in the run configuration.
When I moved many years ago to JB products this was and still is the only thing I am missing.
It is handy for instance if you are developing a compiler and want to run it when you are editing a file you want to feed the compiler with, so I don't need to have a separate run configuration for each file I am editing.
I understand there is no such thing as "variables" in the Script parameters field. Can I obtain the same effect described above in some alternative way?
(besides of course using only one file and one run configuration)
Thanks in advance.
请先登录再写评论。
Hi gapag! Unfortunately it's not possible with Run Configurations (corresponding feature request: IDEA-74031) but you can configure external tool to run active file, here's my basic example to run current file with Python:
You can run it from Tools menu, it's also possible to assign a hotkey for it. Corresponding documentation: https://www.jetbrains.com/help/pycharm/external-tools.html
Hi Pavel. Thank you very much.
Is it possible to enable debugging by some magic in program/parameters? I tried to copy the line shown in pycharm's console whenever I start the debugger, but of course
1) I guess that this hardcodes the port the debugger server is listening (I cannot run several at once, the external tool hangs)
2) It is anyway not enough to make Pycharm discuss with the debugger (when I start it the first time -- hence the port is free I guess -- the external tool hangs at a point it stops at the first breakpoint, but this does not show in Pycharm)
Thank you very much again
Did you try using Debug Sever? https://www.jetbrains.com/help/pycharm/2017.1/remote-debugging.html#6 This is not the best solution (you have to include extra lines in your code) but it's the only one I can come up with.