mfussenegger / nvim-dap

Debug Adapter Protocol client implementation for Neovim
GNU General Public License v3.0
5.46k stars 194 forks source link

Evaluate response throws Error for hover() etc. #1168

Closed dekaravanhoc closed 7 months ago

dekaravanhoc commented 7 months ago

Debug adapter definition and debug configuration

Configured the adapter for godot as described: https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#godot-gdscript Using the current vscode configuration as described here: https://github.com/godotengine/godot-vscode-plugin#gdscript-debugger

Debug adapter version

No response

Steps to Reproduce

  1. In a Godot project set a breakpoint.
  2. Run it till it hits the breakpoint.
  3. Call dap.ui.widgets.hover with any of the variables

Expected Result

Contents of result are in the floating window.

Actual Result

Lua error:

Error executing vim.schedule lua callback: ...ata/Local/nvim-data/lazy/nvim-dap/lua/dap/ui/widgets.lua:380: attempt to compare number with nil
stack traceback:
...ata/Local/nvim-data/lazy/nvim-dap/lua/dap/ui/widgets.lua:380: in function 'callback' 
...ppData/Local/nvim-data/lazy/nvim-dap/lua/dap/session.lua:967: in function <...ppData/Local/nvim-data/lazy/nvim-dap/lua/dap/session.lua:963>

Request and Response are looking good as per protocol specification:

{
  arguments = {
    context = "hover",
    expression = "save_state",
    frameId = 0
  },
  command = "evaluate",
  seq = 24,
  type = "request"
}
[ DEBUG ] 2024-03-01T13:52:07Z+0100 ] ...ppData/Local/nvim-data/lazy/nvim-dap/lua/dap/session.lua:951 ] 1   {
  body = {
    result = '{ "metal_upgrade_group": {  }, "health": 2000, "weapon_systems": { "res://game/entities/player_ship/ship_upgrades/weapon_systems/laser_beam/laser_beam.tscn": { "metal_upgrade": { "metal_upgrade_group": {  } }, "current_upgrades_paths": [], "number_of_deployed_turrets": 2 }, "res://game/entities/player_ship/ship_upgrades/weapon_systems/cannon/start_cannon.tscn": { "metal_upgrade": { "metal_upgrade_group": {  } }, "current_upgrades_paths": [], "number_of_deployed_turrets": 2 } }, "combat_modules": { "res://game/entities/player_ship/ship_upgrades/combat_modules/shield_generator/shield_generator.tscn": { "metal_upgrade_group": {  }, "is_deployed": true } } }'
  },
  command = "evaluate",
  request_seq = 24,
  seq = 47,
  success = true,
  type = "response"
}

Scopes and Stacks are working without errors.

mfussenegger commented 7 months ago

Looks like the error happens in resp.variablesReference > 0 because variablesReference is missing from the response.

Looking at the EvaluateResponse definition that field is required.

I'd say this appears to be an issue with the godot dap implementation.

dekaravanhoc commented 7 months ago

Ah Indeed. Ill take it over to godot. Thanks. :)