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

Debugging PHP works, but status stays as 'running' after script is done #1257

Open
jorismak opened this issue Jun 6, 2024 · 0 comments
Open

Comments

@jorismak
Copy link

jorismak commented Jun 6, 2024

Debug adapter definition and debug configuration

Installed the adapter via Mason.
It's called 'php-debug-adapter' there, and it installs https://github.com/xdebug/vscode-php-debug.

When trying to debug something, it is working.

nvim-dap installed through lazy.nvim.

return {
	"mfussenegger/nvim-dap",
	version = "*",
	config = function()
		local dap = require("dap")
		local dapui = require("dapui")

		require("mason-nvim-dap").setup({
			automatic_installation = true,
			handlers = {},
			ensure_installed = {
				"php-debug-adapter",
			},
		})

               -- vim.keymap.set() commands truncated. Binding things to dap.continue, etc...

		dapui.setup()

		vim.keymap.set("n", "<F7>", dapui.toggle, { desc = "Debug: See last session result." })

		dap.listeners.before.attach.dapui_config = function()
			dapui.open()
		end
		dap.listeners.before.launch.dapui_config = function()
			dapui.open()
		end
		dap.listeners.before.event_terminated.dapui_config = function()
			dapui.close()
		end
		dap.listeners.before.event_exited.dapui_config = function()
			dapui.close()
		end

		dap.configurations.php = {
			{
				name = "PHP: Listen for Xdebug",
				port = 9003,
				request = "launch",
				type = "php",
				breakpoints = {
					exception = {
						Notice = false,
						Warning = false,
						Error = false,
						Exception = false,
						["*"] = false,
					},
				},
			},
		}
	end,
}

Debug adapter version

1.34.0

Steps to Reproduce

I set a breakpoint in a program, hit my keybind (F5) to start debugging.
nvim-dap-ui appears.

At this moment, it shows in nvim-dap-ui icons that I can 'restart', 'stop' or 'disconnect'. I also see the 'pause' symbol as I expect from vscode.
image

I now make a request, so I 'start the script'. The breakpoint triggers! I see local variables, etc...
The 'B' for the breakpoint changes to an arrow, to indicate that is where the run cursor is I suppose.
image

The status icons change to indicate I can now continue running the pogram, and al the step-over, step-into, etc... options. So far, so great!
image

But, if I hit f5 again (dap.continue), the script continues and finishes. The breakpoint indicator changes back to a B:
image

But the status icons don't change, as if it still thinks the script is running and didn't finish:
image

So, my first instinct is to think the script is still running and held up somewhere, while it's actually finished.

Expected Result

I expect the status icons to change back to the state before the script started. Also, how it happens in vscode with the same debug adapter, that's where my expectations come from :).

Now, I have no clue if this is a problem with nvim-dap-ui, or in the real status in nvim-dap. But I also don't really have a clue how to figure that out or debug it further.

Actual Result

I've cleaned out dap.log, set the log level to debug, and started a new test:
start Neovim, use telescope to open file. Set breakpoint, start debugging. (start script, breakpoint hits). Continue debugging / execution (script finishes), nothing changes on screen except the breakpoint indicator. At that point, I've exited with a :qa, and returned the dap.log as is:

dap.log.gz

If it seems to be something in nvim-dap-ui, then I'm sorry, and I'll take it there. But I was hoping the log file could shine some light on what happens and if it's expected or not.

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

1 participant