Skip to content

Assign value to new local variable doesnt use final when prefer_final_locals #3542

@Sunbreak

Description

@Sunbreak

Describe the bug
Assign value to new local variable still makes var when prefer_final_locals present in lint rules

var i = 1 + 2 + 3;

To Reproduce

  1. Create project: dart create my_dart
  2. Add code: 1 + 2 + 3
  3. Refactor code: press keys CMD + .

Expected behavior

final i = 1 + 2 + 3;

Screenshots
Screen Shot 2021-08-27 at 11 19 43 AM

Versions (please complete the following information):

  • VS Code version: 1.59.1
  • Dart extension version: v3.25.1
  • Dart/Flutter SDK version: flutter-2.2.3

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 enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions