Skip to content

feat: add breakpoint column support#224

Open
GustavEikaas wants to merge 3 commits into
Samsung:masterfrom
GustavEikaas:feat/add-breakpoint-column-support
Open

feat: add breakpoint column support#224
GustavEikaas wants to merge 3 commits into
Samsung:masterfrom
GustavEikaas:feat/add-breakpoint-column-support

Conversation

@GustavEikaas

@GustavEikaas GustavEikaas commented Apr 19, 2026

Copy link
Copy Markdown

My attempt at implementing what was discussed in #219 and resolves #83.

As discussed with @viewizard, the approach is: use the column to pick the right IL offset while keeping the 1 breakpoint per line rule. Column 0 falls back to existing behavior.

I had to make some heuristics changes in SymbolReader.cs, feel free to sanity check me.

When a column is provided, sequence point selection for the outer method prefers the SP whose StartColumn is closest to (but not exceeding) the target column. A cursorInsideNested guard ensures that when the cursor is positioned inside a lambda's column range, the breakpoint lands in the lambda rather than the outer call site.

column and endColumn are now returned in the DAP setBreakpoints response.

The test case from #83 now works. Tested locally in neovim with various changes and seems to work as expected

Keep in mind I usually never code in C++. If there are edge cases I've missed feel free to tag me and I'll test and fix.

Fixes #83

@viewizard

Copy link
Copy Markdown
Member

This is a large change that should be covered by tests. Please add tests to VSCodeTestSrcBreakpointResolve. You will probably need to add a Context.AddBreakpoint() implementation that has a third operand (column) that should be set manually (I'm not really sure how we could add the same idea as for lines with Label.Breakpoint() for auto line number calculation).

Please cover all possible cases (proper resolve with column inside statement, several breakpoints set to the same statement, etc.), for example:

  1. Multiline code, set breakpoint with column on a non-first line. Breakpoint should be set at the start of the statement.
int a = 
a + 25 +                  <<<=== breakpoint on this line with column 3, for example
ff + 5;
  1. Multiline code with code after it:
int a = 
a + 25 +                  
ff + 5; int a = 5;                 <<<=== breakpoint on this line with column 15 (int a = 5), for example
  1. Multiline code:
int a = 
a + 25 +                            <<<=== first breakpoint on this line with column 3, for example
ff + 5; int a = 5;                 <<<=== second breakpoint on this line with column 15 (int a = 5), for example
  1. Multiline code with code after it, with search for proper next statement:
int a = 
a + 25 +                  
ff + 5; int a = 5;                 <<<=== breakpoint on this line with column 55 (out of int a = 5), for example
int bbb = 10;                     <<<=== real resolved breakpoint location
  1. Multiple breakpoints set for one line:
int i = 0; i++; i--; i = 5;

First set with column 0, then with 17, then with 23.

  1. Multiple breakpoints set for one line:
int i = 0; i++; i--; i = 5;

First set with column 17, then with 0, then with 23.

And so on...

@GustavEikaas

Copy link
Copy Markdown
Author

Yep I agreee, ill make some tests. I did try to run the tests because I considered adding some but ran into some issues with dotnet runtime 3.1 and globalization issues. Ill figure that out and cover it with tests

@viewizard

Copy link
Copy Markdown
Member

You could replace "netcoreapp3.1" with "net10.0" in all ./test-suite files and use .NET 10 as I do ;)

@GustavEikaas

Copy link
Copy Markdown
Author

Ah lol didnt think of that, is it worth considering upstreaming that change or does it break CI stuff?

@viewizard

Copy link
Copy Markdown
Member

CI tests with .NET 3.1, 6.0, 8.0 and 10.0 now in the same way as I wrote - it replace "netcoreapp3.1" with the framework it needs for the current test loop. :)

@GustavEikaas

Copy link
Copy Markdown
Author

Sorry it took a while, I added some tests now. let me know what you think

@GustavEikaas

Copy link
Copy Markdown
Author

@viewizard nudge

Comment thread test-suite/VSCodeTestSrcBreakpointResolve/Program.cs Outdated
Comment thread test-suite/VSCodeTestSrcBreakpointResolve/Program.cs Outdated
Comment thread test-suite/VSCodeTestSrcBreakpointResolve/Program.cs Outdated
Comment thread test-suite/VSCodeTestSrcBreakpointResolve/Program.cs Outdated
@GustavEikaas GustavEikaas requested a review from viewizard May 20, 2026 10:08
@viewizard

Copy link
Copy Markdown
Member

Looks good. I'm fixing the Samsung CI now. As soon as it's up, we can start testing these changes.

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.

Multiple breakpoints on the same line

2 participants