-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Dart Analysis says "Target of URI doesn't exist:" when importing new package #30845
Comments
@scheglov, what triggers a re-analysis of a compilation unit? A change to the |
When you change We read a file only when we create |
I've noticed this too, and had it raised today. How involved is fixing it in the server (I don't mind having a go with some guidance)? (as a workaround we could restart the server from the client, but it's a bit expensive to re-analyze the whole project so it feels a bit overkill). |
If changes to You will pay for new Dart VM start, cold code execution, reading all files in all analysis roots, and reading analysis results cached from the file system. But not for analysis itself :-) The state of |
I'm not sure I understand - if I restart the server, doesn't it need to analyze the project again when it restarts and I set the analysis roots? (it certainly seems like that - if I restart the server VS Code shows that it's analyzing).
Understood, thanks! |
F |
DAS caches analysis results in form of computed errors and indexes in the file system, and if there were no changes to files, it reads these analysis results from the file system, without analyzing anything. Affected files, which directly or indirectly use changed files, will be reanalyzed. The file that you open, so subscribe for its navigation and semantic highlighting, will be analyzed, because these features require resolved AST. |
Aha, I didn't realise that :-) If a fix in the server isn't trivial, I wonder if it's worth adding a flag in VS Code to automatically restart the server when |
Is there any reason why Should the content of the |
The whole content of the |
To be clear, for other readers, you mean clients of So, I'll re-ask the question: Is there any reason why clients of
So we potentially have enough information to know whether the cached data is still valid? The point of my original question, of course, is that I think we ought to figure this out on restart, not just assume that the state of the files hasn't changed since the data was cached. |
I don't see any blockers for listening No, we don't assume that the state of the files hasn't changed, we read every file on start, and if their content happens to be the same, then we reuse analysis results. |
Im facing same issues when add a new packages to pubspec.yaml. Android Studio 3.3.1 Doctor summary (to see all details, run flutter doctor -v): |
@scheglov do you know if anything has changed here? I can't reproduce this with the instructions at the top - when I add the contact_picker import, it's just green (unused) not red (missing). |
Not sure, it seems that quite a long time passed between the day when this issue was reported, and now. I saw yesterday that now DAS listens for |
FWIW I'm not reproducing this anymore either. |
Great, then I think it's safe to assume it's fixed. We can re-open if anyone sees it again on a new-ish build. |
In my case it was just a problem with Visual Studio Code. |
In my case on window platform, I delete the file in 'AppData\Local\Pub\Cache' and then run 'flutter pub get' solved my problem. |
This used to work fine but after upgrading IntelliJ and/or the Dart plugin the analysis can't seem to find the new packages i add to pubspec.yaml.
To reproduce:
I get "Target of URI doesn't exist:" like this:
I'm able to use the methods that come with the package though so everything works fine, its just the Analysis that doesn't recognise the package.
Solution:
CMD -> Shift -> A (Find Action) -> Search for "Dart Analysis" -> Click the icon that says "Restart the Dart Analysis server" -> The red underline disappears from the package import and everything works.
IntelliJ Version
with Dart plugin Version: 172.4155.35
The text was updated successfully, but these errors were encountered: