Skip to content

send empty array for setbreakpoints command - #1592

Open
Jaehaks wants to merge 2 commits into
mfussenegger:masterfrom
Jaehaks:master
Open

send empty array for setbreakpoints command#1592
Jaehaks wants to merge 2 commits into
mfussenegger:masterfrom
Jaehaks:master

Conversation

@Jaehaks

@Jaehaks Jaehaks commented Feb 22, 2026

Copy link
Copy Markdown
  1. Problem

Some debugger like matlab-lsp, It removes unused breakpoints when lsp received setbreakpoints command.

Previously, set_breakpoints() function send nothing when there are no breakpoint. It makes that lsp cannot remove remained breakpoints which are set before.

  1. Solution

Send setbreakpoints request with empty array even though there is no breakpoints

1. Problem

Some debugger like matlab-lsp, It removes unused breakpoints when lsp
received setbreakpoints command.

Previously, set_breakpoints() function send nothing when there are no
breakpoint. It makes that lsp cannot remove remained breakpoints which
are set before.

2. Solution

Send setbreakpoints request with empty array even though there is no
breakpoints
@mfussenegger

Copy link
Copy Markdown
Owner

Can you clarify how you run into this?

If I remove the last breakpoint in a buffer I still get a setBreakpoints command sent like:

{
  arguments = {
    breakpoints = {},
    lines = {},
    source = {
      name = "Foo.java",
      path = "/tmp/Foo.java"
    },
    sourceModified = false
  },
  command = "setBreakpoints",
  seq = 11,
  type = "request"
}

@Jaehaks

Jaehaks commented Feb 26, 2026

Copy link
Copy Markdown
Author

When I executes continue() function these messages are sent from nvimd-dap If I didn't check any breakpoints.

There is no setbreakpoint message between initialize and launch

Content-Length: 343

{"type":"request","arguments":{"linesStartAt1":true,"columnsStartAt1":true,"pathFormat":"path","clientName":"neovim","locale
":"en_US","adapterID":"nvim-dap","clientID":"neovim","supportsStartDebuggingRequest":true,"supportsProgressReporting":true,"
supportsVariableType":true,"supportsRunInTerminalRequest":true},"command":"initialize","seq":1}
Content-Length: 212

{"type":"request","arguments":{"program":"C:\\Users\\USER\\.config\\nvim\\test\\test.m","type":"matlab","cwd":"C:\\Users\\US
ER\\.config\\nvim","request":"launch","name":"MATLAB Debug"},"command":"launch","seq":2}
Content-Length: 56

{"type":"request","command":"configurationDone","seq":3}
Content-Length: 145

{"type":"request","arguments":{"expression":"run('C:\\Users\\USER\\.config\\nvim\\test\\test.m')","context":"repl"},"command
":"evaluate","seq":4}

I created a dap adapter for matlab. To communicate between dap and lsp, I made some read_handler() which send dap message to lsp when the tcp socket received message from dap,
You can find this in nvim-dap-matlab.

When I modify your code like PR, It send empty message correctly.

@mfussenegger

Copy link
Copy Markdown
Owner

If I didn't check any breakpoints. There is no setbreakpoint message between initialize and launch

That's sort of expected. setBreakpoints is optional - a client doesn't have to send it if there are no breakpoints.

It makes that lsp cannot remove remained breakpoints which are set before.

If the language server keeps the breakpoints, couldn't you just always remove breakpoints at the end of a debug session?

chore : update recent code of original repo.
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

Successfully merging this pull request may close these issues.

2 participants