Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code and Flutter/Dart, Widget Autocomplete not working

I'm working with some tutorials to learn Flutter and the one that I'm taking now uses VSCode. I actually prefer it to Android Studio because it doesn't overheat my Macbook. The only frustration I've had with it so far is that there are quite a few times where autocomplete just stops working. For instance, if I wrap a Column in a widget and then start typing Container, Android Studio will pop up an autocomplete showing Container VS Code used to do this for me, but has stopped for some reason. I can still get the autocomplete list if I press Ctrl+Spacebar.

I'm using the following:

  • VS Code - 1.36.1

  • Dart Extension - 3.2.0

  • Flutter Extension - 3.2.0

  • Material Icon Theme - 3.8.0

This is the latest version for all of these.

Is there some setting or something that I need to change? I've spent the last two hours trying to work out what's going on. In searching, I did see some references to earlier versions of VS Code and the extensions causing problems, but nothing about these versions.

like image 510
Scott Kilbourn Avatar asked Jul 12 '19 04:07

Scott Kilbourn


People also ask

Why is VS Code autocomplete not working?

Troubleshooting# If you find IntelliSense has stopped working, the language service may not be running. Try restarting VS Code and this should solve the issue. If you are still missing IntelliSense features after installing a language extension, open an issue in the repository of the language extension.

How do I enable autocomplete in VS Code?

PS: Pressing "Enter" works fine and accepts the suggestion and I can disable it by setting the following setting to off. Don't know if this helps, but you can press CTRL+SPACE to bring up autocomplete.

How do I enable IntelliSense in Visual Studio Code Flutter?

In VsCode, at the bottom of it there's a blue line, in which language mode is not selected. hovering throught the icons and texts you fill find this and selecting on it will display popup "select Language Mode"... just select Dart from it and intellisense will start to work.

Can I use Dart on VS Code?

Dart Code extends VS Code with support for the Dart programming language, and provides tools for effectively editing, refactoring, running, and reloading Flutter mobile apps.


2 Answers

Go to pubspec.yaml and hit save or run get packages. It worked for me, hope it helps

like image 85
Deven Bhadane Avatar answered Oct 03 '22 18:10

Deven Bhadane


There are generally two reasons for VS Code to automatically open code completion - 1) when you press a key that the extension ahs told VS Code should invoke it and 2) when VS Code thinks it would be useful (for example when you start typing on a blank line). If you're typing in a line of existing code it won't always do this.

Pressing Ctrl+Space is the correct way to open completion in the cases where it doesn't appear automatically.

That said, if you can provide more information about a specific instance, I can take a look if it's something we could/should pop completion open for. It would be best raised at https://github.com/Dart-Code/Dart-Code/issues with a screenshot and details of exactly where your cursor is (and how you got there).

like image 28
Danny Tuppeny Avatar answered Oct 03 '22 18:10

Danny Tuppeny