Skip to content

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

@Merrit

Description

@Merrit

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions