VSCode Flutter Dart slow suggestions
Asked Answered
T

3

17

I'm using Visual Studio Code for flutter programming and not using many extensions. I loved the code completion but it's usually too slow. It takes around 1-2 seconds for showing all suggestions. Is there any solution to this problem? Here is my list of installed extensions:

Installed extensions

Thoroughwort answered 20/12, 2020 at 1:37 Comment(0)
P
9

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.

Pyorrhea answered 20/12, 2020 at 2:59 Comment(5)
at which config?Canossa
My Mac Flutter setup's intellisense was way slower than Windows one. Added this option to Open Settings (JSON). Then reloaded and now it's fast like Windows setup.Yseulte
the key is grayed out, unknown configuration?Houck
@Houck and to others who read here, previewLsp setting is long gone from the current Dart Language Extension. It's called dart.useLsp now. If you wish to follow this answer then you should add "dart.useLsp": true, but that didn't solve it for me. In fact, I disabled the LSP and it's now much faster. Just a heads upDye
Thanks for the heads up. In my case I have disabled many extensions for the workspace, now it's much better.Houck
D
6

Update on 14.09.2022

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

Use this instead:

"dart.useLegacyAnalyzerProtocol": true

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
Dye answered 22/6, 2022 at 12:35 Comment(0)
V
5

Using "Recommended Settings" worked for me.

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

This overwrites the recommended settings for Dart.

Visually answered 9/8, 2021 at 9:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.