-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Wrong imports in Stateless Widget snippet from analysis server #49081
Comments
@bwilkerson do I recall you saying this may have already been solved somewhere outside of the server? The import is being added automatically by the edit builder (via We could perhaps list the preferred imports with the snippet and add them (although we'd probably also need to either suppress the edit builder adding its own, or ensure it can tell that the written types are covered by an existing import that isn't where the type is declared). |
The problem is that the analysis server doesn't currently have any support for keeping track of which public libraries export symbols declared in internal libraries. The Although we could special case this support for snippets, we need this information in lots of other places so I'd really prefer to just solve the problem once (most likely via It's possible that we could compute the information efficiently enough that we wouldn't need to cache anything (we should only need to look at the public libraries in a package, and there often aren't very many of those). That would be idea. Otherwise we'll need a cache and a reliable way of determining when the cache needs to be flushed. |
any progress for this issue? |
Not that I'm aware of. |
@DanTup This is a still a major issue. as it slows developing time. I'm really looking forward to this update. |
I'm new to Flutter, but I found this issue annoying as this pops up every time when creating widget in new file. One workaround I'm using right now is adding import manually with some 3rd party snippet extension (details) first before running |
We need a solution to this issue. |
This is still doing this in vscode, is there a way to manually go change the snippet file to change the imports to material, very annoying when its the first snippet to show up in the context menu all the time |
There's no file you can modify as the imports don't come from a file but are inserted automatically by the Dart analysis server when references to types are added by the snippet. This issue has been fixed, but the fix has not yet shipped in a stable release of Flutter. It is available on the Flutter |
In VS Code when using the
stlss
snippet:The resulting code has the imports included:
For me these are the wrong imports and I have to go up and delete them and then add the correct imports.
I discussed with @DanTup on the VS Code Discord and he thought this is a bug with how the server decides which imports to add.
Thanks!
The text was updated successfully, but these errors were encountered: