Search code examples
node.jsvisual-studio-codevscode-debuggervscode-remote

Debugging VSCode Extension within a remote container


I'm currently using vscode-tomcat extension within a RHEL7 container and developing over SSH using the vscode-remote extension. However, I am unable to launch the tomcat debugger due to this unresolved issue.

"TypeError: Cannot set property 'readableListening' of undefined"

The issue only occurs when trying to launch the Tomcat debugger while doing remote SSH development. I am making an attempt to debug the issue, but I'm not sure how to debug a VSCode extension within a remote container.

Any tips would be greatly appreciated. Let me know if I can provide any additional details.


Solution

  • There is now documentation for all of this. Read

    https://code.visualstudio.com/api/advanced-topics/remote-extensions#debugging-using-ssh

    and then keep reading because further down you will find this

    https://code.visualstudio.com/api/advanced-topics/remote-extensions#debugging-using-ssh

    in fact read all of it, there's a lot of stuff there that initially made me think "So?" but which is vital knowledge in specialised problems.

    Here's the portion relating to the immediate problem.

    Debugging using SSH

    Follow steps:

    1. After installing and configuring the Remote - SSH extension, select Remote-SSH: Connect to Host... from the Command Palette (F1) in VS Code to connect to a host.

    2. Once connected, either use File > Open... / Open Folder... to select the remote folder with your extension source code in it or select Git: Clone from the Command Palette (F1) to clone it and open it on the remote host.

    3. Install any required dependencies that might be missing (for example using yarn install or apt-get) in a new VS Code terminal window (Ctrl+Shift+` ).

    4. Finally, press F5 or use the Run view to launch the extension inside on the remote host and attach the debugger.

    Note: You will not be able to open the extension source code folder in the window that appears, but you can open a sub-folder or somewhere else on the SSH host.

    The extension development host window that appears will include your extension running on the SSH host with the debugger attached to it.

    Installing a development version of your extension

    Anytime VS Code automatically installs an extension on an SSH host, inside a container or WSL, or through GitHub Codespaces, the Marketplace version is used (and not the version already installed on your local machine).

    While this makes sense in most situations, you may want to use (or share) an unpublished version of your extension for testing without having to set up a debugging environment. To install an unpublished version of your extension, you can package the extension as a VSIX and manually install it into a VS Code window that is already connected to a running remote environment.

    Follow these steps:

    1. If this is a published extension, you may want to add "extensions.autoUpdate": false to settings.json to prevent it from auto-updating to the latest Marketplace version.
    2. Next, use vsce package to package your extension as a VSIX.
    3. Connect to a codespace, development container, SSH host, or WSL environment.
    4. Use the Install from VSIX... command available in the Extensions view More Actions (...) menu to install the extension in this specific window (not a local one). 5.Reload when prompted.

    Tip: Once installed, you can use the Developer: Show Running Extensions command to see whether VS Code is running the extension locally or remotely.