Sdk: allow analysis server clients to know when analysis has started and stopped

Created on 13 Jan 2020  路  9Comments  路  Source: dart-lang/sdk

@Hixie commented on Jun 10, 2019, 11:43 PM UTC:

Create an empty directory.
Run flutter analyze in it.
It'll hang.
Run touch x.dart in that directory.
The flutter analyze process suddenly completes.

cc @devoncarew @jonahwilliams

This issue was moved by devoncarew from flutter/flutter#34193.

analyzer-server area-analyzer

All 9 comments

@jonahwilliams commented on Jun 11, 2019, 12:18 AM UTC:

Seems like it is probably an issue with the analyzer. We could always walk the directory first to check for no dart files but that feels like a hack

@devoncarew commented on Jun 11, 2019, 2:51 AM UTC:

flutter analyze relies on analysis starting / analysis stopped events from the analysis server to know when the analysis server is processing files. It doesn't send these events if there's nothing to process.

To address this issue, we'd either need to modify the analysis server to send the events even when there's nothing to process, or adapt flutter analyze to exit if there are no dart files in the directory (or child directories).

@Hixie commented on Jan 10, 2020, 1:02 AM UTC:

@devoncarew is there a bug# for the analysis server side of this? (Or do you think we should support this entirely in the tool?)

@devoncarew commented on Jan 13, 2020, 5:33 PM UTC:

We should address in the analysis server, or, add some capability in the analysis server to allow clients to know when analysis has started and stopped.

A summary of the above:

  • tools like flutter analyze rely on the analysis server's analysis starting / analysis stopped events to know when analysis is complete and all errors and warnings have been reported
  • the analysis server doesn't report these events when there are no dart files in a directory
  • this causes tools like flutter analyze to hang at startup, waiting for these events

We should either modify the spec to indicate that the events are always sent, and send them even for empty directories, or provide some other way for clients to know when analysis is complete.

cc @stereotype441, @bwilkerson - this was reported again as https://github.com/flutter/flutter/issues/51007

Now that Flutter plugin federation is a thing, there are going to be more (legitimate) packages that don't contain any .dart files, but may still be run through flutter analyze (just because of CI/CD consistency, like what we saw in flutter/plugins), so I guess this issue might get reported again.

馃憤 thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

55555Mohit55555 picture 55555Mohit55555  路  3Comments

rinick picture rinick  路  3Comments

ranquild picture ranquild  路  3Comments

emilniklas picture emilniklas  路  3Comments

DartBot picture DartBot  路  3Comments