Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DarkMikey opened this issue Jan 12, 2021 · 3 comments
Open

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

DarkMikey opened this issue Jan 12, 2021 · 3 comments

Comments

@DarkMikey
Copy link

DarkMikey commented Jan 12, 2021

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
Copy link
Member

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

@DarkMikey
Copy link
Author

DarkMikey commented Feb 23, 2021

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants