-
Notifications
You must be signed in to change notification settings - Fork 316
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
Find References doesn't work when selection covers an entire symbol #4157
Comments
@bwilkerson I'm trying to debug this and found that NodeLocator() is locating the argument list here in the case where the caret is in front of it (which seems reasonable and maybe should be handled specially). However, I noticed that when the caret is in the name, we don't locate the name, but rather the whole member declaration. This seemed odd to me so I wanted to check this is correct before making any changes. For example, if I run this test code: @soloTest
void test_danny() async {
await resolveTestCode('''
void aaa() {}
''');
result.unit.accept(MyVisitor());
} Where class MyVisitor extends UnifyingAstVisitor<void> {
@override
void visitNode(AstNode node) {
print('Visiting (${node.offset}) $node');
super.visitNode(node);
}
} I get the following output:
What seems off to me here is that there is no visit of the |
Testing the original behaviour up top with stable 2.18.0, it definitely does work, so I think something has changed. I'll try to bisect this tomorrow to figure out what changed (assuming nothing stands out and you might know what it is already). |
|
Aah, you warned me that was coming, makes sense now. It's possible this affects more than just Navigation then - previously the offset between name and args ( I'll fix navigation and check other functionality for similar issues. Thanks! Edit: I wrote "argument" many times above, but while testing realised that (as you stated) this change only affected declarations/parameters (identifiers in front of argument lists are still tokens and don't seem affected). |
Yes, lots of code might potentially be broken. We relied heavily on test cases to catch breakage, but tests can't provide complete coverage. |
…ween name and type/parameter lists Removal AstNodes for names in declarations left some of these places getting FormalParameterList/TypeParameterLists when an offset was between the name and parameter list. This is a fairly common case if you double-click to select a name in VS Code (it sends the end of the name as the offset). This only changes the case where a single offset is provided (not a range), and it is both the start of the parameter list and the end of the name. Fixes Dart-Code/Dart-Code#4157. Change-Id: I1219fa70b0795b61c60f31ad61ff9a34954c8b43 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260381 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Fixed by dart-lang/sdk@d83cb4e. |
Double-clicking on a method name then pressing Shift+F12 doesn't find anything:
(same goes for putting the caret at the end of the name, which is likely the same offset for this selection).
The text was updated successfully, but these errors were encountered: