Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger does not stop in breakpoints in blade files. #986

Open
jsantos42 opened this issue Jan 29, 2025 · 1 comment
Open

Debugger does not stop in breakpoints in blade files. #986

jsantos42 opened this issue Jan 29, 2025 · 1 comment

Comments

@jsantos42
Copy link

Problem: Debugger does not stop in breakpoints in blade files.

PHPStorm can do this if you set the path to bladecache in Settings->PHP->Debug->Debug->Templates->Blade Debug

Is there a way to implement this? Or maybe my config is missing something:

return {
  "mfussenegger/nvim-dap",
  optional = true,
  opts = function()
    local dap = require("dap")
    local path = require("mason-registry").get_package("php-debug-adapter"):get_install_path()
    dap.adapters.php = {
      type = "executable",
      command = "node",
      args = { path .. "/extension/out/phpDebug.js" },
    }
    dap.configurations.php = {
      {
        name = "Debug",
        type = "php",
        request = "launch",
        port = 9003,
        pathMappings = {
          ["/usr/src/wordpress/wp-content"] = "${workspaceFolder}",
          ["/usr/src/wordpress"] = "${workspaceFolder}/.wordpress-src",
          ["/tmp/bladecache"] = "${workspaceFolder}/bladecache",
          ["/usr/src/wordpress/wp-config.php"] = "${workspaceFolder}/.docker/config/wp-config.php",
          -- ["/usr/src/wordpress/wp-content/bladecache"] = "${workspaceFolder}/bladecache",
        },
        xdebugSettings = { show_hidden = 1, max_children = 100, max_data = 1024, max_depth = 3 },
      },
    }
  end,
}

@zobo
Copy link
Contributor

zobo commented Jan 29, 2025

Hi. Path mappings aren't at a functional level to support this (probably). Derick is currently working on this inside Xdebug https://xdebug.org/funding/001-native-path-mapping

However, I would like to know what exactly is happening here. Would you be able to provide some logs? Next to xdebugSettings please add log = true (or 1, I'm not sure about LUA types...).

I'm interested in:

  • What is the exact filename you are setting the breakpoint in
  • What does this file (I'm assuming it's a blade template) get compiled to?
  • If you add the following code: where does the PHP execution stop?
@php
   xdebug_break();
@endphp

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants