dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.25k stars 1.58k forks source link

Dart analyzer and Intellij IDEA is once in a while unusable - and Intellij IDEA just becomes nothing but a raw text editor #45723

Closed fzyzcjy closed 1 month ago

fzyzcjy commented 3 years ago

Hi thanks for the lib! But such behavior of dart analyzer & intellij idea is driving me crazy...

I write Flutter program using Intellij IDEA (with dart & flutter plugins), but the experience is very painful and even unuseable recently :( Let me try to explain it in detail in order to seek the root cause easier:

Firstly, once in a while, the following happens: The syntax highlight disappeaers (every word is white except for keywords; but you know, normally there are many colors, such as purple for fields). The jumping does not work completely. For example, originally I can cmd+B on a class/method name to jump to the definition of the class/method, but now I cannot. In short, almost everything does not work and Intellij IDEA just work as if it is a pure text editor!

Example screenshot:

image

Secondly, I also observe that, when the things above happen, the code formatter also behaves very strangely. When I trigger "format the file", it takes many seconds, and the finally formatted file is strange, in a format that is contrary to the normal format required by Flutter. I guess it is like formatting just partially, but I am not sure. For example, in the screenshot above, I originally added just one or two lines of code, and format it, and it looks like what is in the screenshot. You know, the standard formatting is completely not like this.

Here is another example of strange formatting. Left hand side is the code formatted when flutter behaves normally; right hand side is formatted when it is strange.

image

image

image

Thirdly, such case sometimes last for a few minutes, sometimes even >15 minutes or longer. I have tried the following, but sometimes it works, sometimes it does not work:

more info that is possbly related:

the analysis-driver folder is about 1GB

image

I have read: https://github.com/flutter/flutter-intellij/issues/4012 , https://github.com/flutter/flutter-intellij/issues/4142 , https://github.com/dart-lang/sdk/issues/28383 , etc

gumbarros commented 3 years ago
if(details != null and details.appointments.length == 1){

}

Do you have a if like this in your code? I solved the problem removing this if

fzyzcjy commented 3 years ago

@gumbarros I have >10k lines of flutter code... it is not very possible to find out and remove such lines

wait a bit: you should use '&&' instead of 'and'!

dnkoulouris commented 3 years ago

same problem here. dart analysis is too slow

gumbarros commented 1 year ago

@gumbarros I have >10k lines of flutter code... it is not very possible to find out and remove such lines

wait a bit: you should use '&&' instead of 'and'!

I found this notification 2 years later lol, but my IDE was crashing because of the 'and' instead of the '&&'

mraleph commented 1 month ago

This is unactionable without reproduction of some sort.