Mogens TrasherDK
Mogens TrasherDK

Reputation: 680

VSCode + Remote - SSH + VS Code Debugger for Firefox, How?

So, I'm trying to get the vscode-firefox-debug to play.

It, vscode-firefox-debug, claims to be compatible with vscode remote.

How do I configure this thing, to work with my remote?

All my development is done on a remote headless server, running Slackware64 14.2

Let's call that box www.example.com.

My local box is a Windows 8.1 x64 Pro with:

Firefox 69.0.1 (64-bit)

Visual Studio Code
Version: 1.38.1 (system setup)
Commit: b37e54c98e1a74ba89e03073e5a3761284e3ffb0
Date: 2019-09-11T13:35:15.005Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 6.3.9600

I run firefox with "C:\Program Files\Mozilla Firefox\firefox.exe" -start-debugger-server

I've got the Remote-SSH and friends setup, and working nicely with vscode-php-debug and XDebug.

Adding to launch.json on remote server. I got a few variations I've tried:

First try

    {
      "name": "Launch localhost",
      "type": "firefox",
      "request": "launch",
      "reAttach": true,
      "url": "http://localhost/index.html",
      "webRoot": "${workspaceFolder}"
    },

First launch config

Second try

    {
      "name": "Attach localhost",
      "type": "firefox",
      "request": "attach",
      "url": "http://localhost/index.html",
      "webRoot": "${workspaceFolder}"
    },

First attach config

Third try

    {
      "name": "Launch index.html",
      "type": "firefox",
      "request": "launch",
      "reAttach": true,
      "port": 6000,
      "file": "${workspaceFolder}/index.html",
      "url": "https://www.example.com/index.html",
      "webRoot": "${workspaceFolder}"
    },

And I get a Notification in debug console, saying:

Firefox can't open a file in a remote workspace

Last try

    {
      "name": "Attach index.html",
      "type": "firefox",
      "request": "attach",
      "port": 6000,
      "url": "https://www.example.com/",
      "webRoot": "${workspaceFolder}"
    },

Another failed attempt

Upvotes: 1

Views: 2019

Answers (1)

Patrick
Patrick

Reputation: 26

Follow the link to help you:

https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug

Example to run on server to start manually xdebug while debug by SSH the file on local VS code IDE is:

$ php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 -dxdebug.remote_connect_back=1 /var/www/html/teste.php

Upvotes: 1

Related Questions