Skip to content

Cursor moves to beginning of file while stepping if an exception occurs during a test #4692

@osaxma

Description

@osaxma

Hello there,

It's been a while since I came by .. hope all is well!

Describe the bug

When running a test in debug mode, the cursor in the test file moves to the beginning of the file after each run.

This is inconvenient since after each time I run the test, I have to scroll back to the line wherever the test is to run it again.

To Reproduce
Steps to reproduce the behavior:

  1. create a new dart project (i.e. dart create debug_cursor_issue)

  2. go to the test file and paste the sample code there (given below).

  3. scroll down to the test

  4. place the cursor somewhere within the test

  5. click on the debug button shown above the test within the file.
    image

  6. click the continue button in the debugger controller until the end.

  7. the cursor now should've moved to the top of the file.

>>>> Sample Code <<<<<<
import 'package:dart_code_test_bug/dart_code_test_bug.dart';
import 'package:test/test.dart';

/* 

LONG COMMENT TO SIMULATE THE BUG 


Jump to line 100 

























































































 */

void main() {
  test('calculate', () {
    try {
      expect(true, false);
    } on FormatException catch (e) {
      //
    }
  });
}

Expected behavior

I expect the cursor to stay in its place -- it's inconvenient to keep scrolling back after each run especially in large test files.

Please complete the following information:

  • Operating System and version: 12.6 (21G115)
  • VS Code version: 1.81.1
  • Dart extension version: v3.70.0
  • Dart/Flutter SDK version: Dart SDK version: 3.1.0 (stable) (Tue Aug 15 21:33:36 2023 +0000) on "macos_x64"

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsin testingRelates to test execution of Dart/Flutter tests for end usersis bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions