Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Remove widget" is not available when it's from a library imported with an alias #4169

Closed
ValentinVignal opened this issue Sep 22, 2022 · 1 comment
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug
Milestone

Comments

@ValentinVignal
Copy link

Describe the bug

When a library is imported with an alias (ex: import 'package:flutter/material.dart' as material;), the option "Remove widget" is not available on the widget from this library (ex: material.Center()).

To Reproduce
Steps to reproduce the behavior:

  1. Copy this code
import 'package:flutter/material.dart';
import 'package:flutter/material.dart' as material;

class MyWidget extends StatelessWidget {
  const MyWidget({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return const Center(
      child: material.Center(
        child: Text('Flutter'),
      ),
    );
  }
}

Or check out https://github.com/ValentinVignal/flutter_app_stable/tree/flutter-vscode/remove-widget.
2. Toggle the code actions on Center and then on material.Center.
3. Notice that the code action "Remove widget" is available for Center but not for material.Center.

Expected behavior

I expected to be able to remove Center and material.Center

Screenshots

On Center:

image

On material.Center:

image

Please complete the following information:

  • Operating System and version: macOS Big Sur, version 11.6.8
  • VS Code version: 1.71.2
  • Dart extension version: v3.48.4, Flutter extension version: v3.48.0
  • Dart/Flutter SDK version:
Flutter 3.3.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision e3c29ec00c (8 days ago) • 2022-09-14 08:46:55 -0500
Engine • revision a4ff2c53d8
Tools • Dart 2.18.1 • DevTools 2.15.0
  • Target device (if the issue relates to Flutter debugging): NA
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Sep 22, 2022
… for assists

Fixes Dart-Code/Dart-Code#4169.

Change-Id: I3b462c69520593cbb9db2dc30ae19b8c93deed20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260601
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
@DanTup
Copy link
Member

DanTup commented Sep 22, 2022

Fixed by dart-lang/sdk@3e9a99d. The change is in the Dart SDK, so the fix will show up with a future SDK release (rather than a VS Code extension release).

@DanTup DanTup closed this as completed Sep 22, 2022
@DanTup DanTup added in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server labels Sep 22, 2022
@DanTup DanTup added this to the v3.50.0 milestone Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug
Projects
None yet
Development

No branches or pull requests

2 participants