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

Breakpoint rejected sign "R" appears even though debugger paused #1205

Closed
morhaham2 opened this issue Apr 30, 2024 · 2 comments
Closed

Breakpoint rejected sign "R" appears even though debugger paused #1205

morhaham2 opened this issue Apr 30, 2024 · 2 comments

Comments

@morhaham2
Copy link

morhaham2 commented Apr 30, 2024

Debug adapter definition and debug configuration

return {
  {
    "rcarriga/nvim-dap-ui",
    dependencies = {
      "mfussenegger/nvim-dap",
      "nvim-neotest/nvim-nio",
      "folke/neodev.nvim",
    },
    config = function()
      local dap, dapui = require("dap"), require("dapui")
      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
      vim.fn.sign_define(
        "DapBreakpoint",
        { text = "🛑", texthl = "", linehl = "", numhl = "" }
      )
      require("neodev").setup({
        library = { plugins = { "nvim-dap-ui" }, types = true },
      })
      require("dapui").setup()
    end,
  },
  {
    "mfussenegger/nvim-dap",
    config = function()
      local dap = require("dap")

      -- Go
      dap.adapters.go = {
        type = "executable",
        command = "node",
        args = {
          os.getenv("HOME") .. "/dap/vscode-go/extension/dist/debugAdapter.js",
        },
      }
      dap.configurations.go = {
        {
          type = "go",
          name = "Debug",
          request = "launch",
          showLog = false,
          program = "${file}",
          dlvToolPath = vim.fn.exepath("dlv"),
        },
      }

      -- Nodejs
      require("dap").adapters["pwa-node"] = {
        type = "server",
        host = "localhost",
        port = "${port}",
        executable = {
          command = "node",
          args = { "/Users/morh/dap/js-debug/src/dapDebugServer.js", "${port}" },
        },
      }
      require("dap").configurations.typescript = {
        {
          type = "pwa-node",
          request = "attach",
          -- sourceMaps = true,
          outDir = "dist",
          -- restart = true,
          name = "Launch file",
          program = "${file}",
          cwd = "${workspaceFolder}",
        },
      }

      -- keymaps
      vim.keymap.set("n", "<F5>", function()
        require("dap").continue()
      end, { desc = "Continue" })
      vim.keymap.set("n", "<F6>", function()
        require("dap").disconnect()
      end, { desc = "Continue" })
      vim.keymap.set("n", "<F2>", function()
        require("dap").step_over()
      end)
      vim.keymap.set("n", "<F3>", function()
        require("dap").step_into()
      end)
      vim.keymap.set("n", "<F4>", function()
        require("dap").step_out()
      end)
      vim.keymap.set("n", "<Leader>b", function()
        require("dap").toggle_breakpoint()
      end, { desc = "Toggle breakpoint" })
      vim.keymap.set("n", "<Leader>B", function()
        require("dap").set_breakpoint()
      end)
      vim.keymap.set("n", "<Leader>lp", function()
        require("dap").set_breakpoint(
          nil,
          nil,
          vim.fn.input("Log point message: ")
        )
      end)
      vim.keymap.set("n", "<Leader>dr", function()
        require("dap").repl.open()
      end)
      vim.keymap.set("n", "<Leader>dl", function()
        require("dap").run_last()
      end)
      vim.keymap.set({ "n", "v" }, "<Leader>dh", function()
        require("dap.ui.widgets").hover()
      end)
      vim.keymap.set({ "n", "v" }, "<Leader>dp", function()
        require("dap.ui.widgets").preview()
      end)
      vim.keymap.set("n", "<Leader>df", function()
        local widgets = require("dap.ui.widgets")
        widgets.centered_float(widgets.frames)
      end)
      vim.keymap.set("n", "<Leader>ds", function()
        local widgets = require("dap.ui.widgets")
        widgets.centered_float(widgets.scopes)
      end)
    end,
  },
  {
    "folke/neodev.nvim",
    opts = {},
  },
}

Debug adapter version

js-debug-dap-v1.89.0

Steps to Reproduce

  1. In a typescript run tsc && node --inspect-brk ./dist/main.js
  2. continue until debugger stops at the first breakpoint

Expected Result

The debugger stops at the right breakpoint and the sign afterwards should not be "R"

Actual Result

The column sign is "R"

image
@mfussenegger
Copy link
Owner

Can you show the logs? If a B turns into a R is mostly up to the debug adapter, so not sure there's much to be done here on the client side.

@mfussenegger
Copy link
Owner

Closing due to lack of feedback

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