Skip to content

Add to watch and evaluate in debug console, doesn't work with multiline selection #2391

Closed

Description

@HerrNiklasRaab

If I select multiple lines to evaluate in console or for adding it to the watch, it only evaluates the first line: https://imgur.com/5M7WzJH

Edit: Just tried in Android Studio, there it works.

Activity

  1. DanTup commented on Apr 23, 2020

    @DanTup
    Member

    When I evaluate in the debug console, it seems to work ok:

    Screenshot 2020-04-23 at 16 52 11

    For the watch window, the label only shows the first line, but if I double-click in it, it does expand and has the full amount (and the value shown when expanding it is also correct for all of the lines).

    Are you able to reduce your code to a standalone script that still repros that I can run here? Thanks!

  2. added
    awaiting infoRequires more information from the customer to progress
    on Apr 23, 2020
  3. HerrNiklasRaab commented on Apr 24, 2020

    @HerrNiklasRaab
    Author

    I reinstalled macOS, now it works again. Don't know what caused this.

  4. DanTup commented on Apr 24, 2020

    @DanTup
    Member

    Weird - if you see it again and can capture a log, let me know!

  5. added and removed
    awaiting infoRequires more information from the customer to progress
    on Apr 24, 2020
  6. HerrNiklasRaab commented on Apr 24, 2020

    @HerrNiklasRaab
    Author

    Hey @DanTup,

    I can reproduce again. The logs are attaached, I did evaluate two expression in the debug console. One with test.stream and one with:

    test.stream
          .skipWhile((int i) => i < 2)

    The interesting thing was, that I was only able to reproduce in a flutter project or a library that had flutter in it's pubspec.yaml. Did you tried your code in a pure dart library? So if you try to reproduce, try a flutter project.

    Create a new Flutter project and add this to the main:

    import 'dart:async';
    
    import 'package:flutter/material.dart';
    
    void main() {
      StreamController<int> test = StreamController<int>();
      test.add(1);
      test.add(2);
      test.add(3);
      test.add(4);
      var test2 = test.stream
          .skipWhile((int i) => i < 2)
          .skipWhile((int i) => i > 3)
          .map((int i) => i + 1);
    
      runApp(MyApp());
    }

    These are the logs:
    Dart-Code-Log-2020-03-06 00-17-46.txt.zip

  7. DanTup commented on Apr 27, 2020

    @DanTup
    Member

    @HerrNiklasRaab Thanks! You were right, I only tested with Dart. Can easily repro in Flutter by just pasting a multiline expression into the debug console.

    I believe this is a Flutter issue - expression evaluation is a little different for Flutter, as the expression has to be compiled and sent over to the device for evaluation - I suspect the issue is in the Flutter code that handles this.

    I've opened flutter/flutter#55731 about this, and also dart-lang/sdk#41671 because I noticed trailing semicolons cause issues too. You can subscribe to them for updates.

    Thanks!

  8. DanTup commented on May 4, 2020

    @DanTup
    Member

    Closing this as it seems entirely a Flutter issue and once fixed in flutter/flutter#55731 it'll work here in VS Code without any further changes. Subscribe there for updates - thanks!

  9. added this to the v3.142.0 milestone on Aug 11, 2026
  10. added
    in flutterRelates to running Flutter apps
    in debuggingRelates to the debug adapter or process of running debug sessions
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    and removed on Aug 11, 2026
  11. DanTup commented on Aug 11, 2026

    @DanTup
    Member

    This was fixed in flutter/flutter#190722 and will be included in a future Flutter SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed in dart / flutterin debuggingRelates to the debug adapter or process of running debug sessionsin flutterRelates to running Flutter appsrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions