Search code examples
visual-studio-codepycharmremote-debugging

Can I do remote debugging with PyCharm and Visual Studio Code on the same server?


I have some C++ and Python code which I sometimes want to debug. I have a server to which I connect my debugger using ssh. All my code in on the server.

I use Visual Studio Code for both C++ and Python for now; I wonder if I can switch to PyCharm for Python. I want to retain the ability to debug my C++ code using Visual Studio Code.

Is this possible? If yes, are there any obvious caveats? Like maybe I need to use different ports somehow?

I tried setting it up, but got many problems. I am trying to understand if it's possible at all; if yes, I'll try to fix all these small problems.


Solution

  • According to the documentation of VSCode remote code execution is handled by an extension saved on the server: https://code.visualstudio.com/docs/remote/ssh
    If you setup remote debugging with PyCharm a similar thing happens where some IDE code is installed on the server to be able to pipe commands and results back and forth: https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html#remote-interpreter

    Inherintly it seems these two approaches are not at odds, given you don't try to run them both at the same time. If you run them both at the same time they might conflict about (port) forwarding in SSH.

    For PyCharm remote debugging there are now 2 options, the remote interpreter which has your IDE locally and your interpreter/execution on the server and a remote development with a server which runs more code on that server to be able to give you the IDE experience. They might conflict in different ways with VSCode.

    As far as caveats go I have found that remote execution environments can consume quite a bit of space. So keep an eye on that.

    Of course all standard security concerns apply as well, but that is not linked to one or multiple remote code environments.