You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Code completion stops returning results after running a Flutter app #2973
After the app runs completely the dart analyzer is showing errors if I do something wrong but the snippets are not working but it gets fixed after restarting the dart analysis server. And if the dart analyzer is restarted while the app is compiling this issue doesn't occur. This issue mostly occurs in the stable channel of flutter.
Flutter stable 1.22.4. I don't "The Dart Analyzer has terminated" message during builds but the snippets for flutter don't work also if I press the lamp to import the required library I don't see the library in the list also the wrap with widget is not there.
changed the title [-]Dart Analyzer "{"analysis":{"isAnalyzing":false}}" after running.[/-][+]Code completion stops returning results after running a Flutter app[/+]on Dec 2, 2020
Could you try capturing a log for me to review using a small sample project and with LSP enabled? Use a small sample project because the log may include parts of source code, and the smaller project will produce a smaller log.
Enable the Preview LSP setting in VS Code
Create a simple app using flutter create and open it in VS Code
Run the Open Workspace Settings command in VS Code (note: workspace!)
Reload VS Code with the Developer: Reload Window command
Reproduce the issue
This should create a file at logs/analyzer.instrum.txt logging everything going on in the analysis server. This might get quite large, but you can paste it into a gist or zip it up and email it to me ([email protected]).
I made a simple using flutter create and did all the things you told me. But I am not able to reproduce the issue there. This issue occurs when the project is big.
I made a simple using flutter create and did all the things you told me. But I am not able to reproduce the issue there. This issue occurs when the project is big.
Are you able to create a project that triggers this problem that you can share?
Otherwise, could you share:
The output of running code --status in a terminal after this has happened (but while VS Code is still open)
@bwilkerson@scheglov I was able to fairly reliably reproduce this issue in a script which repeatedly spawns a Flutter app, stops it, deletes the build folder. After a number of times, completions no longer include any suggestion sets with them.
I narrowed it down to occurring whenever the following is printed to the analysis server instrumentation log:
After this occurs (handled here) calls to computeIncludedSetList get a null from tracker.getContext(analysisContext) which results in failing to add the completions here (which seems to be because the context is destroyed and/or recreated):
If I trigger _handleWatchInterruption in code (for example by setting a timer to call it after 10 seconds in the ContextManagerImpl constructor), it reproduces reliably without needing to spawn Flutter or trigger lots of filesystem activity (presumably this will also happen on macOS).
@DanTup - thanks for the investigation and analysis! Can you create a corresponding issue in the dart-lang/sdk repo? I'd like to try and get a fix in for this for the next beta release.
Activity
DanTup commentedon Dec 2, 2020
Do you mean you see "The Dart Analyzer has terminated" messages during builds?
Can you confirm exactly what Flutter version you're on (run
flutter --version)? Thanks!IsmailAlamKhan commentedon Dec 2, 2020
Flutter stable 1.22.4. I don't "The Dart Analyzer has terminated" message during builds but the snippets for flutter don't work also if I press the lamp to import the required library I don't see the library in the list also the wrap with widget is not there.
DanTup commentedon Dec 2, 2020
Can you provide an exact code sample/screenshot showing this so I can try to reproduce?
Can you also confirm whether you have the "LSP Preview" setting enabled in VS Code/Dart settings? Thanks!
IsmailAlamKhan commentedon Dec 2, 2020
No, I don't have "LSP Preview" enabled. And here is a video showing the error
Dart_Analyzer_Error.zip
DanTup commentedon Dec 2, 2020
@IsmailAlamKhan thanks for the video!
A few questions/suggestions:
Thanks!
IsmailAlamKhan commentedon Dec 2, 2020
[-]Dart Analyzer "{"analysis":{"isAnalyzing":false}}" after running.[/-][+]Code completion stops returning results after running a Flutter app[/+]DanTup commentedon Dec 2, 2020
Could you try capturing a log for me to review using a small sample project and with LSP enabled? Use a small sample project because the log may include parts of source code, and the smaller project will produce a smaller log.
flutter createand open it in VS CodeThis should create a file at
logs/analyzer.instrum.txtlogging everything going on in the analysis server. This might get quite large, but you can paste it into a gist or zip it up and email it to me ([email protected]).Thanks!
IsmailAlamKhan commentedon Dec 2, 2020
I made a simple using flutter create and did all the things you told me. But I am not able to reproduce the issue there. This issue occurs when the project is big.
IsmailAlamKhan commentedon Dec 2, 2020
I checked with my other projects and I can reproduce it there.
onaoura commentedon Dec 2, 2020
I am facing same issue. Autocomplete is working fine before running the project. Once I run it, autocomplete stop working.
DanTup commentedon Dec 3, 2020
Are you able to create a project that triggers this problem that you can share?
Otherwise, could you share:
code --statusin a terminal after this has happened (but while VS Code is still open)pubspec.yamlpubspec.lockfileThanks!
IsmailAlamKhan commentedon Dec 3, 2020
I zipped the output of
code --statusand a copy of mypubspec.yamlandpubspec.lockcode_status.zip43 remaining items
DanTup commentedon Jan 12, 2021
@bwilkerson @scheglov I was able to fairly reliably reproduce this issue in a script which repeatedly spawns a Flutter app, stops it, deletes the
buildfolder. After a number of times, completions no longer include any suggestion sets with them.I narrowed it down to occurring whenever the following is printed to the analysis server instrumentation log:
After this occurs (handled here) calls to
computeIncludedSetListget anullfromtracker.getContext(analysisContext)which results in failing to add the completions here (which seems to be because the context is destroyed and/or recreated):https://github.com/dart-lang/sdk/blob/d63d5d93a59b370bf5f5c277109110cb67a96b75/pkg/analysis_server/lib/src/domains/completion/available_suggestions.dart#L24-L25
If I trigger
_handleWatchInterruptionin code (for example by setting a timer to call it after 10 seconds in theContextManagerImplconstructor), it reproduces reliably without needing to spawn Flutter or trigger lots of filesystem activity (presumably this will also happen on macOS).devoncarew commentedon Jan 12, 2021
@DanTup - thanks for the investigation and analysis! Can you create a corresponding issue in the dart-lang/sdk repo? I'd like to try and get a fix in for this for the next beta release.
DanTup commentedon Jan 12, 2021
@devoncarew I've filed dart-lang/sdk#44650. I'll close this this one as I don't think there's anything to do here.