Skip to content

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

Closed

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

Activity

  1. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    and removed on Aug 30, 2021
  2. added this to the v3.27.0 milestone on Aug 30, 2021
  3. DanTup commented on Aug 31, 2021

    @DanTup
    Member

    This is fixed in the Dart SDK (dart-lang/sdk@f9db0dd). It'll ship in a future SDK release (rather than a Dart-Code release). Thanks!

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

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions