-
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
Dart Analyzer in Flutter stops suggesting Classes as you type (and doesn't import them) #44321
Comments
I also have the same issue, Reloading window solves the issue. But the debugging stops and after a while it happens again. This happens in both Android studio as well as VS code. And I wonder this issue is still not posted before. |
Same here. No sure if it's connected but since it started around the same time: "hot reloading" freezes frequently now and only terminating the run process seems to help. Super annoying. |
Any updates guys? |
I also have the same issue. |
Same as here, once you reload the VS Code, it does work until you start debugging again. |
Don't forget guys to thumb up the original question to draw more attention to this issue! :) |
I have just noticed that it most often happen when I use Android API 30 x64 device with Google Play services where if I use devices without Google Play on them it works fine. |
It's happening with me for a month now. Could this be a Windows-only issue? |
I am facing the same problem, there is no problem on Linux platform but when I use windows, the problem arises |
I'm facing the same issue in windows. I recently uninstalled visual studio completely and starting using it. Is there any options that need to be changed in settings or use any plugins? |
same problem here |
Guys, it's been 2 months now and this issue still persists. Any updates? |
I have the same problem :( |
Temporary fix:
|
Even though it restarts the Dart Analyzer and it starts suggesting the classes as it should, it kills the 'Hot Reload on Save' feature, thus any time I change anything I have to manually hit 'Hot Reload' button which is even worse than manually importing the classes... |
Same super annoying issue flutter doctor -v[✓] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.19042.746], locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [!] Android Studio (version 4.1.0) [✓] VS Code (version 1.52.1) [✓] Connected device (1 available) ! Doctor found issues in 1 category.
|
Same here, and it's really annoying! 😞 |
Same for me, IntelliJ - Windows 10 |
Don't forget to thumb-up the original question to attract more attention 👍 |
I deleted Flutter completely then I have installed Flutter This is a productivity-killer issue |
But you can always use shortcut key |
In this case, it's more time consuming to press ctrl+r (the shortcut I created) every time I make a change rather than manually import files. If you have to import classes just a couple of times per file, the hot reload is necessary tens or hundreds of times more. |
I don't have this issue, I'm on master channel. |
I still have this issue (accidentally closed the issue, thus I reopened it) |
Hi - thanks for all the feedback on this issue. I'm trying to gather a bit more information to help us diagnose the problem. From my understanding, from the first comment, after some period of time code completion stops suggesting types from the imported libraries. Is that correct? Or, is the issue that code completion no longer suggests types from not yet imported libraries (auto-adding the import when you select that completion entry)? Could one or two people confirm the above issue? And, could several people post their configuration? I'd like to try to narrow this down to an OS if possible, and determine whether it still happens on recent (beta) versions of Flutter. If people could append to this issue w/ the below template that would be great:
Thanks in advance! |
@devoncarew I also wanted to clarify that this issue happens after some period the application is run and/or after I hit Can it be because the project is relatively large? ~30k lines of code.
|
operating system: Windows 10 20H2 Thank you |
operating system: Windows 10 this definitely seems related to Windows OS |
This seems to be fixed in Flutter 2.0 👍 ❤️ |
Same here 😞 |
same here... and this is VERY frustrating operating system: Windows 10 20H2 |
Operating system: MacOS Catalina 10.15.7 For me it was always like this. Classes inside library (file) are autocompleted correctly, but imported are not. It doesn't matter if I import through export, or directly. After I type Class name completely it doesn't show error and IntelliSense works |
I'm having this problem as well on android studio it seems that all autofill takes ages now. And many times it forgets to import package when pressing enter on the class |
I have that option turned on and it's still giving me issues. I think it's somewhere deep in Dart Analyzer where it just terminates if either the project size is too big, or it contains some dependencies, or there is something special about the project structure (I have no idea how to troubleshoot that...). The tricky part is that you have to restart the whole debugging session and it might not even come back. @devoncarew is there anything else I/we could provide to speed up the resolution of this issue? |
I can confirm the problem exists in latest version of dart, flutter & Android studio too (Please check the logs below) My Environment details
Mostly, I experienced it, when typing As a temporary fix, the below methods fix the problem (temp)
Hoping for a fix :) TIA |
It's not a solution but a possible workaround for those open to switching dev environments. |
Guys any updates on this one? |
I was migrating When typing in VSCode, I'm not sure if it related to this issue, or should create a new one. flutter doctor -vjerryzhou@Jerrys-MacBook ~/D/c/f/p/r/robo> flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale en-CN)
• Flutter version 2.2.3 at /Users/jerryzhou/Documents/code/flutter/sdk/flutter
• Framework revision f4abaa0735 (3 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc1)
• Android SDK at /Users/jerryzhou/Library/Android/sdk
• Platform android-30, build-tools 30.0.0-rc1
• Java binary at: /Users/jerryzhou/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/192.6392135/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.6)
• Android Studio at /Users/jerryzhou/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/192.6392135/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✗] Cannot determine if IntelliJ is installed
✗ Directory listing failed
[✓] VS Code (version 1.58.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.24.0
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.164
! Doctor found issues in 1 category. |
@venkata-reddy-boya as @anburocky3 suggested the same, it doesn't always work because it terminates the debug session for some, thus it's not a solution. |
I also experience this very same issue, on several projects with different levels of complexity from simple to medium. In some projects, I have long maps having 10K or 20K lines, but not a complex code architecture. In some of them, I have very few external dependencies such as:
I use Android Studio, I prefer using flutter commands (from a terminal inside IDE) rather than hot reload button etc. I usually use a real device rather than the emulator. These details seem to conflict with some of the other reporters here, so they seem irrelevant to the issue. I use Windows 10 though, which may narrow down where we see the issue (I had the same issue on Windows 7 as well). |
Please note, excluded directories aren't detected by the dart analyzer. For me, I was excluding generated files and some directories, so that Autocomplete wasn’t detecting it. Also, check 'analysis_options.yaml' file for exclude tag. |
For me, I just change one thing. Go to Dart Analysis and click on the settings icon and check Scope analysis to the current package. This will solve the problem. |
Worked for me thanks @tausifali |
Please can you tell me how to go dart analysis in vs code |
Apologies for not responding earlier. And sorry but I think I have to ask more clarifying questions. @kovalyovi in your response 16 months ago, you wrote:
I had thought that the issue was that after some period of the IDE running with Dart Analysis Server, DAS will stop providing any auto-completion. But from this it sounds like it will still suggest lists of names, but not the ones you expect. Yes? Specifically classes?
Hmm what do you mean by "recognizes" it? Like it highlights the word with the color for classes?
This is very interesting. It does seem like the request is getting lost or blocked behind the "Go to Implementations" request. I think @kovalyovi 's issue is specific to this "it works for a while, within one session, then it stops working" problem. If anyone else has an issue of not-yet-imported elements (like classes) not being included anywhere in code completion, ever, please file a separate issue. |
Thanks. There is also the same StackOverflow answer which has a checked mark: |
BELOW WILL WORK FOR SURE This will not make any sense but it works. Whenever you face this issue,
As stupid as it sounds it is working like a charm! |
@scheglov Is the behavior above likely a result of clearing the server's caches? If so, is there some information we're missing in the cache keys? If not, can you think of why upgrading and downgrading that way would cause the analysis to resume? |
I am building an app in Flutter and the problem I started facing I described on Stackoverflow
Basically, at some point, as I launch my flutter project, after a couple of minutes the Dart Analyzer stops suggesting autocompletion of the imported classes (widgets), for example when I type Text - it doesn't suggest the Text widget with a description but the IntelliSense still recognizes it once I finish the widget name. The biggest problem though is with imports. If I type something I already created (for example static class ThemeConstants.), it neither suggests the full class name nor it auto-imports that object. The funniest is that when I created a fresh new project, everything works as it should (it suggests import and auto-completion for the object names).
Unfortunately, my project is not shareable but it has 21k lines of code and ~30 dependencies. Everything worked fine until I cleared some cache on the computer (that's the only thing that went differently).
I tried running Dart: Capture Logs command in VS Code and in the project that I just created, I tried capturing the time when I type "Text" and right after entry with the following log
it's followed by
Whereas the main project Analyzer stopped at this line and didn't do anything with "Text"
I apologize if I'm doing something wrong and wanted to get advice on either how to fix that or where to refer for help.
The text was updated successfully, but these errors were encountered: