Skip to content

Fix all does not work on part of files. #4813

@nero-angela

Description

@nero-angela

Reproduce

  1. Turn on the fix all option when saving in VSCode.
  2. Create the main.dart file and sub.dart file using dart’s part & part of syntax as follows.
    • main.dart
    import 'package:flutter/material.dart';
    
    part 'sub.dart';
    
    void main() {
      runApp(const Sub());
    }
    • sub.dart
    part of 'main.dart';
    
    class Sub extends StatelessWidget {
      const Sub({super.key});
    
      @override
      Widget build(BuildContext context) {
        return Column(
          children: [
            SizedBox(), /// 👈 Use 'const' with the constructor to improve performance.
          ],
        );
      }
    }
  3. Even if you save in the sub.dart file, fix all does not work, so const is not added before SizedBox().
  4. If you save in the main.dart file, fix all will work in the sub.dart file.

Expected

I think even if saved in the sub.dart file, const must be added in front of SizedBox().

Video

2023-10-25.1.09.45.mov

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 bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions