Navigation Menu

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

Convert Getter to Method doesn't work for extensions #3846

Closed
Merrit opened this issue Feb 27, 2022 · 3 comments
Closed

Convert Getter to Method doesn't work for extensions #3846

Merrit opened this issue Feb 27, 2022 · 3 comments
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

@Merrit
Copy link

Merrit commented Feb 27, 2022

Describe the bug
Using the refactor feature to convert a getter to a method doesn't work if said getter is part of an extension.

To Reproduce
Steps to reproduce the behavior:

  1. Add a getter to an extension
  2. Right click getter name -> Refactor -> Convert Getter to Method

Expected behavior
Getter should be changed to a method.

Example:

enum Category {
  metal,
  wood,
  glass,
}

extension ExtraEnumFuntionality on Category {
  String get someValue => 'returnValue'; // FAIL
}

class SomeClass {
  String get aValue => 'aReturnValue'; // SUCCESS
}

extension ExtraClassFunctionality on SomeClass {
  String get someValue => 'returnValue'; // FAIL
}

Versions (please complete the following information):

  • VS Code version: 1.64.2
  • Dart extension version: 3.34.0
  • Dart/Flutter SDK version: Flutter 2.11.0-0.1.pre, Dart 2.17.0
@Merrit Merrit added the is bug label Feb 27, 2022
@DanTup DanTup added this to the v3.36.0 milestone Feb 28, 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 Feb 28, 2022
@DanTup
Copy link
Member

DanTup commented Feb 28, 2022

Thanks! I have a fix for review at https://dart-review.googlesource.com/c/sdk/+/234600/. The change is in the Dart SDK so would ship with an upcoming Dart/Flutter SDK rather than a Dart-Code release. I'll keep this issue open until the change has passed review and landed.

Thanks!

copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Feb 28, 2022
Fixes Dart-Code/Dart-Code#3846.

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

DanTup commented Feb 28, 2022

The fix has landed in dart-lang/sdk@0359628.

@DanTup DanTup closed this as completed Feb 28, 2022
@Merrit
Copy link
Author

Merrit commented Feb 28, 2022

Well that was quick! Thank you :)

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