VSCode Flutter Dart slow suggestions

Viewed 4212

I'm using Visual Studio Code for flutter programming and using less extension, I loved the code completion but usually too slow. it took around 1-2 seconds for showing all suggestions. Is there any solution to this problem? here is my list of installed extensions https://i.stack.imgur.com/jfrD7.png

3 Answers

I was told to add this config:

"dart.previewLsp": true,

which would put the plug-in into speaking the Language Server Protocol rather than a proprietary protocol, and it seems to have sped things up.

Accepted answer and resetting the recommended language settings haven't worked out for me.

Although, I've continued to research a bit more and the LSP part seemed promising simply because it popped out in a bunch of unrelated sources too. But instead of enabling LSP to speed things up, people suggest going in the opposite direction and disabling LSP. Specifically, a person from the Dart VSCode team (at GitHub):

The only other thing I could suggest is disabling LSP but also disabling auto-import completions

Said settings can be set from settings.json like below:

"dart.useLsp": false,
"dart.autoImportCompletions": false

Update on 14.09.2022
dart.useLsp key is no longer valid: v3.48 release notes

Use this instead:

"dart.useLegacyAnalyzerProtocol": true

Using "Recommended Settings" worked for me.

Steps: Cntrl + Shift + P > Type and select "Use Recommended Settings".

This overwrites the recommended settings for Dart.

Related