Craigt
Craigt

Reputation: 3580

Intellisense not triggering in VSCode for Dart/Flutter

In the last week or two IntelliSense has just stopped automatically triggering for the flutter project that I'm working on. If I hit cmd+space the IntelliSense menu will pop up with the correct items given the context. But it just does not show by itself

I don't remember changing any settings but it's super annoying and I'm looking for a way to get back to the old behavior.

An example, when in the constructor of a widget, IntelliSense will not pop up for named parameters.

Or simply being on a new line and start typing a few characters, nothing pops up, even though there are valid IntelliSense items.

Upvotes: 4

Views: 14149

Answers (11)

Fawzi Gharib
Fawzi Gharib

Reputation: 1

So what for worked for me was that I have to delete everything in dart settings which you can open it using CTRL + SHIFT + P or in the bottom left corner there is a gear icon, click it, then go to Command palette and search for Dart: User Recommended settings a box will pop-up in the bottom right corner then click Open settings file after it is opened copy-paste the json code below inside setting file

{
"[dart]": {
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "editor.rulers": [
        80
    ],
    "editor.selectionHighlight": false,
    "editor.suggestSelection": "first",
    "editor.tabCompletion": "onlySnippets",
    "editor.wordBasedSuggestions": false
}}

Upvotes: 0

Seldens
Seldens

Reputation: 11

I ran into this problem, my solution was:

  1. Uninstall flutter and dart extension
  2. Restart VS.code
  3. Reinstall the Flutter extension (Dart extension will install automatically)
  4. Restart VS.code

And voilà ;)

Upvotes: 1

Anas Yousuf
Anas Yousuf

Reputation: 523

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. you don't have to remove any dart settings.

Upvotes: 1

Kevin B
Kevin B

Reputation: 71

I also had success removing an empty dart-specific block from my settings and restarting VSCode.

  1. Cmd+Shift+P
  2. type "settings.json"
  3. select "Open Settings (JSON)"

My dart entry looked like this:

  "[dart]": {
       // "editor.tabSize": 2,
       // "editor.insertSpaces": true,
       // "editor.detectIndentation": false,
    },

After removing, saving, then restarting everything works as expected

Mac OS Big Sur: 11.2.3 VSCode: 1.54.1 Flutter 1.22.6 • channel stable • https://github.com/flutter/flutter.git Framework • revision 9b2d32b605 (7 weeks ago) • 2021-01-22 14:36:39 -0800 Engine • revision 2f0af37152 Tools • Dart 2.10.5

Upvotes: 4

Emmanuel
Emmanuel

Reputation: 5395

In my case I removed the dart block from settings.json. Restarted VS and voila!

Upvotes: 3

jaredbaszler
jaredbaszler

Reputation: 4809

I had this problem but just for one project. My solution was as follows:

  1. I was developing a Flutter Web project and somehow my channel got switch back to the master channel. So I switched it back to flutter channel beta.
  2. I then ran Flutter upgrade.
  3. It still wasn't working so I had to do a combo of restarting VS but then also opening an closing any open editors that were previously open within VS.

Once I did this, intellisense came back but only 1 line. I was able to fix that by expanding the intellisense pop-up by dragging and expanding the tooltip pop-up. This is a new feature added in VS Code 1.5.1 and could possibly be the underlying issue to this problem. Explanation of this feature is here:

https://code.visualstudio.com/updates/v1_51#_intellisense

In the end I was able to fix it without having to add anything to my settings.json file.

Upvotes: 0

Toni
Toni

Reputation: 5115

Try enabling the "Preview LSP" option in the VS Code/Dart settings and then reload VS Code.

Upvotes: 3

shaheer shukur
shaheer shukur

Reputation: 1167

In case "editor.quickSuggestions": true," didn't work for you, try adding the below statement too in the [dart] section of your settings.json

"editor.suggestOnTriggerCharacters": true

Upvotes: 0

theredcap
theredcap

Reputation: 692

The same happened with me yesterday, dart analysis server was not working,i tried restarting VS Code, tried using Android Studio nothing worked, used the flutter doctor command to check what happened, it downloaded the new Dart SDK and hence after the problem was solved.

Upvotes: 1

GrahamD
GrahamD

Reputation: 3165

It could be that you need to update Flutter. I have seen issues like this before and an update has solved the problem. However, I recommend that you follow this link https://gitter.im/dart-code/Dart-Code and chat to Danny Tuppeny who I believe develops the Dart extension for VSCode. I'm sure he can help.

Upvotes: 0

Craigt
Craigt

Reputation: 3580

Somewhere along the road my workspace setting was created with just this line in it:

"editor.quickSuggestions": false,

Which obviously caused quick suggestions to stop showing. This was not in the general vscode settings so I didn't even notice it.

No idea how this was added.

Upvotes: 4

Related Questions