-
Notifications
You must be signed in to change notification settings - Fork 318
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
Flutter autocomplete suggestions not working #5978
Comments
|
Yes I do. Everything was working correctly until now. Autocomplete for widgets worked fine until now. I also tried autocomplete in another project and it worked fine. I created empty project and autocomplete also worked so it seems that the issue is tied to this project but what is bothering me is that everything was ok until I launched emulator. |
I would not expect the emulator to affect completion. To be honest, this is a puzzle. I don't know what project-specific thing could cause this. Your quickest remedy may be to re-create your project. If you don't want to do that you could try Have you ever opened the Android module as its own project in Android Studio ( |
Luckily project is not big so I recreated it. I tried
I did not. When I go to |
Sorry, but the menu item name changes depending on what is selected in the Project view. In your screen shot, it is named Does completion work as expected in the new project? Since I'm guessing the answers to these two questions are "no" and "yes", I'm going to see if I can get some help trying to understand what went wrong in the original project. |
I can think of a couple of possibilities, but they all seem very unlikely. Code completion depends on analysis, and analysis depends on having a valid and up-to-date Analysis also depends on being able to read the source for those packages from the Or if some of the files needed for analysis are on a file system that became inaccessible, that could potentially cause problems.
@stevemessick Is there something different about how the emulator runs when running in a tool window that would explain this? @BojanDolic If you manually type |
@bwilkerson Yes, I can even click to open its source code. Here is the video, hope it will help: 2022-02-25-19-06-32.mp4 |
@BojanDolic When using the project you re-created and running the emulator in the embedded window, does completion work as expected? |
@stevemessick I tried to recreate the problem in the new project but I couldn't. I tried running the emulator inside the tool window, getting dependencies, but none of that worked. This is not the first time this happened to me, I was watching a tutorial a couple of weeks ago and I cloned the GitHub repo for the tutorial and after a day or two same thing happened but I was still learning so I thought I messed up something and the project was pretty old in terms of flutter version so I finished that project without completion because it was not big. |
I'm sorry @BojanDolic but I didn't quite follow that. If you are concerned about possibly corrupting your project then I'd suggest making a zip file of it, then trying the embedded emulator. If completion gets broken you can delete the project and unzip the zip file to restore. I can't think of any way using the embedded emulator would affect completion. That's why I'm asking if you can confirm that completion does work with the embedded emulator. Also, what's the tutorial you were using when you had this problem before? |
@stevemessick Okay I ran the emulator inside the tool window and it seems that everything works fine, so I'm really confused about what could stop auto-completion to work.
I was following a course by Angela Yu about flutter, here is the link to the course: |
Thanks for the link. Apparently, something can get mis-configured in the project that causes completion to stop working correctly. Completion is complex; it is actually implemented in the Dart plugin, which uses the Dart analysis server to do the heavy lifting of computing suggestions, but also provides a hook that the Flutter plugin uses to support its outline. So, in theory, something could go wrong in any of the three components (Dart plugin, Flutter plugin, Dart analyzer). It sounds like you are in good shape now. If this happens again, please let us know. For now, I'm going to keep it open and hope I get some time to investigate the tutorial you referenced. One more thing. I mentioned |
@stevemessick Thanks for suggestion, I tried If I recall correctly when I opened the emulator in a tool window I also added the image as an asset so I had to change |
Thanks for the reply. I can't help thinking something is wrong in your pub cache. But aside from completely deleting it I don't know how to determine if that is true. I don't recommend deleting it because it is shared among all Flutter and Dart projects. I'm out of ideas, I'm afraid. At least we got you back to a workable state. |
I think I have the same problem and I've put up with it for quite a while now (between half a year and a year I guess) but it would be great to find a solution. I blew away the pub cache, ./dart_tool and the flutter/dart plugins in Android Studio with no long. All plugins and Android Studio are up to date. I'd be up for helping out debugging if there are some log files I can look in to or something else. To be clear: if I type BoxDecoration there is no completion suggested and I can't auto-import. I can navigate to it though. |
@stevemessick I've had a look at the IDE logs whilst opening a project where the flutter importing works fine vs one where it is broken. I noticed that when I open the broken project an NPE is thrown which may be relevant: logs excerpt
flutter doctor -v
|
As a last resort I tried using Adding the following back has made everything work again, hopefully this solves it for someone else too: dependencies:
flutter:
sdk: flutter |
@rorystephenson Thanks for participating and presenting your solution. Unfortunately, my |
@BojanDolic Re-reading this just now, I thought of one more thing to try, and another question. First, the question. You mentioned doing And then you could try deleting the |
Sorry for the late response. I was using I deleted |
Ah, that would have done |
我也遇到了这样的问题,最近在学习Flutter开发,在创建工程时,Model Name命名了一个大写开头的英文单词,然后自动补全在我学习的这几天就一直是这样,无法自动补全,今天无意间把Model Name文件名改成了小写开头的英文单词,然后在再Android Studio里面打开工程,自动补全就好使了。 |
According to Google translate, the previous comment is:
That's interesting. I'm not sure what @BojanDolic Could your project be affected by capitalization? |
@stevemessick I opened the project to test capitalization. Before I did anything I wanted to test if autocompletion works by some miracle so I went to my screen file and to my surprise, autocompletion now WORKS. I didn't change anything nor did I open the project from the last time. Before I opened this old project I worked on my current project and updated Kotlin and Dart plugins. I restarted AS and then opened my old project. Is it possible that this somehow fixed it ? |
I'm glad it is working, but I don't know what changed to make it work. However, I'm pretty sure that the problem was not in the Flutter plugin, so I'm closing this issue. Thanks for your help! |
It recently started to happen to me as well, and I think it was after updating to Flutter 3.0. I hope they fix it with a minor update soon. |
same issue |
This just started happening to me after Flutter 3.0, suggestions like setState and overrides such as initState and didChangeDependecies aren't working anymore. May we reopen this please? |
I second @thassio-vinicius this is a small issue but it lags the productivity of developer and it needs to be fixed |
Same here. Tried to reset IDE, did not help.
also when I try to auto-import widgets, before it ask me from what I want “material” or “cupertino”. Next ex, I try to type Edg , and there everything but EdgeInsets, and event I typed full word, it lacks of suggestions like EdgeInsets fromLTRB/all etc This happens a while ago
For ex VS Code works as before |
Omg, finally I find out someone who has the same issue with a setState. I'm new to programming (and learning Flutter) and can't realize the reason for such thing. So, this is just a glitch of 3.0 and will be fixed? ;) |
Should be fixed according to 3.0.2 EDIT: Apparently setState still not working dart-lang/sdk#49027 (comment) |
Yep, setState still not working, can confirm it. |
Screen.Recording.2022-06-18.at.10.46.39.movI'm having problems related to imports too, the auto-complete only works when i force using CTRL + SPACEBAR two times I'm using Flutter latest version (3.0.2) |
Oh Thanku Man ♥❤💞 |
Is there a solution? Same problem. Import, setState, etc |
Flutter 3.0.3 • channel stable • https://github.com/flutter/flutter.git |
I often encounter this problem... |
I facing this issue after I upgrade my vscode |
Same problem... Android Studio Electric Eel | 2022.1.1 and Flutter 3.7.0 Suggestions not working but autocomplete works using CTRL + SPACEBAR two times |
Same problem: EDIT: After days of pain, I was finally able to fix: https://stackoverflow.com/a/63096892/17075671 |
My autocomplete suggestions just stopped working.
As an example, none of the widgets show inside suggestions window when I start typing, here is the screenshot when I want to add BoxDecoration:
First image
Second image
Steps to Reproduce
I'm not exactly sure how this happened, but the issue started when I ran android emulator inside tool window ( I ran it as a separate window before.)
I created this project few days ago and everything was working fine until now.
Version info
Edit:
I tried to fix it with invalidate caches and restart, flutter clean, without emulator running, running emulator outside tool window again. None of those things fixed the problem.
The text was updated successfully, but these errors were encountered: