question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple `debugger();` statements in a codeblock messes up highlighting.

See original GitHub issue

Describe the bug In a codeblock with multiple debugger() statements, the highlighting is inconsistent.

To Reproduce Steps to reproduce the behavior:

  1. create the hello world app with flutter create
  2. In main.dart, replace _incrementCounter() with:
void _incrementCounter() {
    print(0);
    debugger(); //1
    print(1);
    setState(() {
    print(2);
      debugger(); //2
    print(3);
      _counter++;
    print(4);
    });
    print(5);
    debugger(); //3
    print(6);
  }
  1. Run (with or without debugging, it doesn’t matter)

Expected behavior On pressing the floating action button Line with //1 should be highlighted first (and highlighted), followed by //2 and //3 on continuing twice respectively.

Screenshots

Ran the project(on web):

Screenshot 2021-03-28 at 6 49 42 PM

Clicked the FAB:

Screenshot 2021-03-28 at 6 49 54 PM

Pressed continue:

Screenshot 2021-03-28 at 6 50 54 PM

Pressed continue:

Screenshot 2021-03-28 at 6 51 05 PM

Versions (please complete the following information):

  • VS Code version: 1.54.3 (Universal)
  • Dart extension version: 3.20.1
  • Dart/Flutter SDK version: Channel stable, 2.0.1, on macOS 11.2.3 20D91 darwin-x64

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
DanTupcommented, Mar 31, 2021

No problem, I suspected it might be web (there’s a lot of complicated mapping that goes on for web). Looks like it’s not DWDS, the original source map generated by ddc may be wrong, so I’ve filed https://github.com/dart-lang/sdk/issues/45544 about this.

2reactions
DanTupcommented, Mar 29, 2021

Thanks for the report! I can repro this, though only on web - so I think it may be a DWDS issue (it provides the information to understand the location of where the debugger pauses). I’ve filed this over at https://github.com/dart-lang/webdev/issues/1292 with some additional info from the debugger logs that will hopefully help fix. Please subscribe to that issue if you’d like updates.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common problems and solutions - Code::Blocks
1 I cannot use the debugger. 1.1 Problem; 1.2 Solution. 2 Multi-targets library and executable ignore interdependence.
Read more >
A case against syntax highlighting - Linus Åkesson
But as we know, professional syntax highlighting almost never colors two words next to each other in different colors, it colors the key...
Read more >
Debugger arrow and highlighting is missing
During debugging Visual Studio used to show a yellow arrow on the left side and ... but there's no arrow and statement is...
Read more >
Syntax - Neovim docs
Syntax highlighting enables Vim to show parts of the text in another font or ... SpecialComment special things inside a comment Debug debugging...
Read more >
Are you writing print() statements to debug your Python code?
I was one such person who used to debug code using print() statements. Some times, if the code is lengthy, then there are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found