bluefireteam / vscode-dart-import

A simple plugin for VSCode to change all Dart/Flutter imports to relative format.
64 stars 14 forks source link

"Fix all imports" > "No dart files were found" #33

Open DarkMikey opened 3 years ago

DarkMikey commented 3 years ago

dart-import.fix-all will result in info message "No dart files were found".

I have a nested project structure, that contains several packages. I assume this is the reason why the extension can't find any dart files?

const filesUris = await vscode.workspace.findFiles('lib/**/**.dart', excludeFiles);

if (filesUris.length === 0) {
    showInfoMessage('No dart files were found');
    return;
}

Is there anything I can do beside enabling dartImport.fixOnSave?

flutter doctor
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.19041.685], locale de-AT)
    • Flutter version 1.22.5 at C:\Flutter
    • Framework revision 7891006299 (5 weeks ago), 2020-12-10 11:54:40 -0800
    • Engine revision ae90085a84
    • Dart version 2.10.4

[√] VS Code, 64-bit edition (version 1.52.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.18.1

• No issues found!
luanpotter commented 3 years ago

yes, probably. can you share a sample of your structure tree? so I can better understand the issue?

DarkMikey commented 3 years ago

Our tree is like that.

.
├── app/
│   ├── pubspec.yaml
│   └── lib/
├── data/
│   ├── pubspec.yaml
│   └── lib/
├── client/
│   ├── pubspec.yaml
│   └── lib/
└── repository/
    ├── pubspec.yaml
    └── lib/

To be clear dartImport.fixOnSave didn't change anything. I have to open a specific folder (e.g. app) in vs code (so a pubsec.yaml or /lib is in root(?)) to get it to work.

I guess one has to modify the lib/**/**.dart expression that is passed as an argument to the findFiles() function, but I have honestly no clue if more wildcards will be suffienct 😀

JanZeman commented 9 months ago

Was this considered to be fixed? I guess many of us uses the tree structure mentioned above, i.e. multiple packages. I would not mind narrowing it down to one package scope dart-import.fix-package if that would make the fix simpler.