-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving pubspec.yaml does not run analysis server and unable to import new package. #3440
Comments
Can you give a concrete example of how you're reproducing this? I've tried, but been unsuccessful. Here's what I did:
If you follow these same steps, do you see the same? |
@DanTup Sorry I missed the notification about this issue and today I did a look and found your reply. I have attached a gif which explains my problem. It is not happening to me only but one of my friend is facing this problem too. |
This problem sucks |
Can you reproduce this? If so, could you try clicking It might take a few moments for the analysis server to re-analyze after the packages are fetched. Usually you'd see "Analyzing..." in the status bar while this is happening, although I couldn't see that in your GIF, it might be collapsed due to the other items visible on the status bar. |
@DanTup Yes this happens every single time and it is just very very annoying. This is the output
Analyzer runs when flutter pub get runs but also stops before flutter pub get finishes. So after pub get is finished no "Analyzing.." is seen. May be it is due to long time it takes to fetch package? Mine took 19s while yours 915ms. |
It's possible, but the analyzer is triggered by the It would be useful to capture an instrumentation log: https://dartcode.org/docs/logging/#analyzer-instrumentation Note: This will will include parts of your source code, so it is best to reproduce this on a newly created project for this purpose. The log will get quite large over time (since it logs all communication with the analysis server) and you'll want to disable it once you're done testing. |
It's also worth running |
I will give the log tomorrow maybe and will also see how much time |
@DanTup I have sent you email (logs@dartcode.org) with the instrumentation log file and link to this github issue. |
Thanks for the log - I can see the change to
I'm wondering if this is related to #3438 (although that's flutter_gen, I wonder if the timing might also result here in the Thanks! |
Hi @DanTup
also after
timestamps are different |
@2shrestha22 did you also grab the log when you captured those timestamps? I'd like to see exactly what the language server was doing around the time the package_config file is changing (after the pubspec was modified). Thanks! |
@DanTup I have sent you email with the log and this is the time stamp for that log.
|
@2shrestha22 thanks! From the log you sent, I don't see any file watcher event for the modification of the In the log there is this at the same time the
And then around the time of the timestamp of your
Can you reproduce this on a new project created with If you modify the @bwilkerson @scheglov FYI - I'm not sure what's happening here, but it seems like the Do we know of any other reasons why watch events might be missed? I wondered if it could be related to the discussion in dart-lang/sdk#14373 (comment) about watcher events not being particularly reliable, but that says
But this doesn't match up - since we had no events after the |
@2shrestha22 can you also confirm your platform - is this Linux? The other issue I linked above was macOS, so this might be a different watcher implementation. |
Yes if I comment the newly added package >> save >> uncomment again >> save then it appears.
I am using Linux and @pranavo72bex is also using Linux. |
@devoncarew and @scheglov have more context than I do. Unfortunately @scheglov will be out for the next several days so he might not be able to reply to this question quickly. But no, I'm not aware of any other reported issues with the watcher package.
I'm not sure why we're re-analyzing after a change to the I wonder whether we're filtering out the watch events before logging them (based on something like the file being inside a dot directory). |
I was wondering the same. I haven't seen any watch events from I have a possible fix for #3438 but it requires some refactoring, so maybe once that's done I can look at why (or whether we can remove) rebuilding from pubspec. It does seem silly if moments later |
Konstantin will probably know why we're rebuilding after changes to the |
@DanTup It is only in Linux, I have tried in Windows today and I didn't encounter any problem. |
This issue has been marked stale because it is tagged awaiting-info for 20 days with no activity. Remove the stale label or comment to prevent the issue being closed in 10 days. |
This comment is for removing the stale label. |
Any update on this? |
Sorry for the delay. I'd been investigating a similar issue on macOS which I think has the same cause (a race condition if the package_config is modified while the analyzer is rebuilding because of another change), but my simple fix doesn't solve the whole problem so needs further work. It's still on my list and I hope to get back to it soon. |
@DanTup Windows has issues as well. For me, import doesn't work at first (specially when using the Also, Those two problems can be related. NOTE: Doesn't matter if using new LSP or not. |
@JCKodel please file a new issue about the unsaved-pubspec issue, as that's unrelated to whether The first issue you describe does sound like the other race I mentioned. If |
I believe this issue is the same cause as #3438 which is that the server starts rebuilding contexts after the That issue is fixed by dart-lang/sdk@650b962 which is in the SDK so will show up in a future SDK release. If you continue to see this after that change goes out and you've upgraded, please let me know! |
I think this problem stay with us forever 😄 |
@pranavo72bex this was recently fixed (see my comment above yours) but likely has not made a stable release yet. If you still see the issue after the next stable (non-hotfix) releases, please let me know. |
Describe the bug
After adding a package in pubspec.yaml and saving the file analysis server do not analyze changes and we can not import newly added package.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
After saving and downloading package we should be able to import newly added package without needing to restart vs code or analysis server.
Screenshots
I will provide if needed.
Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: