-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
"show all symbols" in VSCode has become unreliable #57035
Comments
Yeah, there's definitely something weird gong on here... When I type "danny", I see "danny_foo" up until typing the "y", then it also disappears: search.mp4I'll take a look. |
Looks like the request is failing with an error:
@scheglov I'm not familiar with this error - any ideas? It does seem to work sometimes.. I triggered this while initial analysis was still happening but I don't know if that's related. |
Coincidentally or not, both of your examples stopped working after the fifth character. Just to point this out. I'll see if I can find some other pattern as well. |
I could not repro the same response of 5 characters within a test file for the SDK. But I have a theory that when the list gets to a length lower than some number (not sure if it is simply smaller than the shown amount on screen or what) of elements, that happens. Seems that whenever I get to a point where multiple elements would vanish at once, this behaviour shows itself. |
Also, when testing the above I got an error as well. Here are the specific error and the full log (it is from the SDK so I have no sensitive data): {"id":16,"jsonrpc":"2.0","method":"window/workDoneProgress/create","params":{"token":"ANALYZING"}}
[12:45:43] [Analyzer] [Info] ==> Content-Length: 73
[12:45:43] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":16,"result":null,"clientRequestTime":1730907943840}
[12:45:43] [Analyzer] [Info] <== Content-Length: 118
Content-Type: application/vscode-jsonrpc; charset=utf-8
[12:45:43] [Analyzer] [Info] <== {"jsonrpc":"2.0","method":"$/progress","params":{"token":"ANALYZING","value":{"kind":"begin","title":"Analyzing…"}}}
[12:45:44] [Analyzer] [Error] [Bad state: Expected existing element: root::dart:_internal::@fragment::dart:_internal/list.dart::@class::UnmodifiableListBase::@constructor::new
#0 LinkedElementFactory.elementOfReference (package:analyzer/src/summary2/linked_element_factory.dart:225:7)
#1 ResolutionReader._readRawElement (package:analyzer/src/summary2/bundle_reader.dart:2464:28)
#2 ResolutionReader.readElement (package:analyzer/src/summary2/bundle_reader.dart:1970:19)
#3 ConstructorElementLinkedData._read (package:analyzer/src/summary2/bundle_reader.dart:231:39)
#4 ElementLinkedData.read (package:analyzer/src/summary2/bundle_reader.dart:269:5)
#5 ExecutableElementImpl.parameters (package:analyzer/src/dart/element/element.dart:3583:17)
#6 ExecutableMember.parameters (package:analyzer/src/dart/element/member.dart:280:24)
#7 ElementResolver._resolveArgumentsToFunction (package:analyzer/src/generated/element_resolver.dart:453:37)
#8 ElementResolver.visitInstanceCreationExpression (package:analyzer/src/generated/element_resolver.dart:248:9)
#9 InstanceCreationExpressionResolver._resolveInstanceCreationExpression (package:analyzer/src/dart/resolver/instance_creation_expression_resolver.dart:59:31)
#10 InstanceCreationExpressionResolver.resolve (package:analyzer/src/dart/resolver/instance_creation_expression_resolver.dart:49:5)
#11 ResolverVisitor.visitInstanceCreationExpression (package:analyzer/src/generated/resolver.dart:3061:41)
#12 InstanceCreationExpressionImpl.resolveExpression (package:analyzer/src/dart/ast/ast.dart:10410:14)
#13 ResolverVisitor.dispatchExpression (package:analyzer/src/generated/resolver.dart:763:16)
#14 TypeAnalyzer.analyzeExpression (package:_fe_analyzer_shared/src/type_inference/type_analyzer.dart:564:9)
#15 ResolverVisitor.visitConstructorFieldInitializer (package:analyzer/src/generated/resolver.dart:2371:5)
#16 ConstructorFieldInitializerImpl.accept (package:analyzer/src/dart/ast/ast.dart:4390:15)
… |
In all cases these are synthetic constructors of class type aliases like abstract class UnmodifiableListBase<E> = ListBase<E>
with UnmodifiableListMixin<E>; I believe I broke it with recent changes. |
Hm... Cannot reproduce so far. solo_test_classAlias_constructors_afterReading() async {
newFile('$testPackageLibPath/a.dart', r'''
part of 'test.dart';
class X = A with M;
''');
var library = await buildLibrary('''
part 'a.dart';
class A {}
mixin M {}
''');
_elementOfLibrary(
library,
['@fragment', 'package:test/a.dart','@class', 'X', '@constructor', 'new'],
);
} |
OK, I can reproduce it. solo_test_classAlias_constructors_afterReading() async {
var library = await buildLibrary('''
abstract mixin class A {}
mixin M {}
class X = A with M;
''');
var X = _elementOfLibrary(
library,
['@fragment', 'package:test/test.dart','@class', 'X'],
) as ClassElementImpl;
X.constructors;
} |
Ah, great! I only had a manual repro and hadn't yet figured out what was going on. I had synced SDK at 9645a71 and added |
In my empty project for understanding bugs, I can repro this with nothing similar to the above: 20241106_160432.mp4I don't think this is all there is to it but maybe Dan is right and something else got triggered by the more characters I wrote but that is not what I would expect. |
We search the SDK and packages too, so it's possible something in there is triggering this. The |
https://dart-review.googlesource.com/c/sdk/+/393960 The issue was that during
The solution is to read |
Bug: #57035 Change-Id: I48aa20815b56c49f08e22509126f74891e694644 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393960 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
I recently rebuilt my analysis server. Previously I was running the version from 1e624b8; now I'm running the version from c549a73.
I'm noticing that the "show all symbols" command in VSCode no longer reliably shows me results. If I search for a class that I'm certain exists, about half the time I simply see "no matching workspace symbols".
I don't have repro steps, but here's an interesting clue: I just checked out a branch in which I know I have a method somewhere whose name starts with
solo_
. I triggered "show all symbols" and typedsolo_
, and as I was typing, I briefly saw the method I was looking for. But when I typed the final_
, the result disappeared. Then I hit backspace to discard the final_
, and the result appeared again.The text was updated successfully, but these errors were encountered: