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 navigation doesn't work correctly for conditional imports #3071
The code in LibraryAnalyzer._validateUriBasedDirective looks like it will validate the "selected" one (the one whose condition is matched), although in my testing it seems to always only ever validate the main uri (in a test it seems like the selected URI is always the main one, although I'm not sure if that's just because something isn't set up for the test or that's also what's happening when I try it in a real project).
I suspect it's not difficult to additionally validate each conditional uri, though since the existing code appears to be trying to use the "selected" URI I'm not certain if that's the right route.
The analyzer's support for conditional imports is not as complete as I'd like it to be. I suspect that the code you pointed to was an earlier attempt to conform to the specification before we realized that it didn't really make sense to do so in the analyzer (because there's no way for users to define the flags that control which URI would be selected).
We can, and should, both validate the conditional URIs and provide navigation from them to the referenced file. I don't think either of those should be tied to the "selected" URI.
Great - I'll take a look at validating each URI then.
For the navigation, it seemed to be working but was returning too many regions which caused VS Code to open a Peek window letting you pick between them (it would include all conditional uris instead of only the one at the requested location). I have a fix for that at https://dart-review.googlesource.com/c/sdk/+/202772/ (@osaxma if that wasn't what you were seeing, let me know and we can debug some more).
changed the title [-]code navigation and linting doesn't work with conditional imports [/-][+]Code navigation doesn't work correctly for conditional imports [/+]on Jun 21, 2021
I'm splitting this issue because there are two problems and one is fixed, but the other has some complications.
#3422 relates to not showing errors, which I have a fix in progress for but there are some details to work out.
This issue is now just for navigation, which is fixed by dart-lang/sdk@eb28368 (if my reproduction of the issue is the same - which is that multiple ranges are returned and VS Code shows them all in the peek window, rather than just jumping to the correct one). The fix will be included in an upcoming (non-hotfix) SDK release.
Activity
DanTup commentedon Jun 8, 2021
@bwilkerson do you know what the expected behaviour is for the missing files here?
The code in
LibraryAnalyzer._validateUriBasedDirectivelooks like it will validate the "selected" one (the one whose condition is matched), although in my testing it seems to always only ever validate the main uri (in a test it seems like the selected URI is always the main one, although I'm not sure if that's just because something isn't set up for the test or that's also what's happening when I try it in a real project).I suspect it's not difficult to additionally validate each conditional uri, though since the existing code appears to be trying to use the "selected" URI I'm not certain if that's the right route.
bwilkerson commentedon Jun 8, 2021
The analyzer's support for conditional imports is not as complete as I'd like it to be. I suspect that the code you pointed to was an earlier attempt to conform to the specification before we realized that it didn't really make sense to do so in the analyzer (because there's no way for users to define the flags that control which URI would be selected).
We can, and should, both validate the conditional URIs and provide navigation from them to the referenced file. I don't think either of those should be tied to the "selected" URI.
DanTup commentedon Jun 8, 2021
Great - I'll take a look at validating each URI then.
For the navigation, it seemed to be working but was returning too many regions which caused VS Code to open a Peek window letting you pick between them (it would include all conditional uris instead of only the one at the requested location). I have a fix for that at https://dart-review.googlesource.com/c/sdk/+/202772/ (@osaxma if that wasn't what you were seeing, let me know and we can debug some more).
[-]code navigation and linting doesn't work with conditional imports [/-][+]Code navigation doesn't work correctly for conditional imports [/+]DanTup commentedon Jun 21, 2021
I'm splitting this issue because there are two problems and one is fixed, but the other has some complications.
#3422 relates to not showing errors, which I have a fix in progress for but there are some details to work out.
This issue is now just for navigation, which is fixed by dart-lang/sdk@eb28368 (if my reproduction of the issue is the same - which is that multiple ranges are returned and VS Code shows them all in the peek window, rather than just jumping to the correct one). The fix will be included in an upcoming (non-hotfix) SDK release.