mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:51:29 +00:00
Use 'parsedUnit' of the file as a starting point for the completion.
When we start identifying this synthetic `FieldDeclaration` with code `fo;` as something that needs resolution (actually enclosing nodes require declared elements), and use this `FieldDeclaration` as a starting point to find the `CompletionTarget.entity`, we find the `VariableDeclaration` `fo`. But if we start with `CompilationUnit` (as we used to), we find `FieldDeclaration` `fo;`. Which gives different starting points for contributors, and changes the resulting suggestions. So, for now I will switch to using the whole parsed unit. Change-Id: I153ae4de9faad2f8147f413b36dd8f2dd7bc5a6c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244380 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
de3cec3a47
commit
b5241f8c4f
|
@ -24,7 +24,6 @@ import 'package:analyzer/src/util/performance/operation_performance.dart';
|
|||
import 'package:analyzer_plugin/protocol/protocol.dart' as plugin;
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
/// The handler for the `completion.getSuggestions2` request.
|
||||
class CompletionGetSuggestions2Handler extends CompletionHandler
|
||||
|
@ -185,8 +184,7 @@ class CompletionGetSuggestions2Handler extends CompletionHandler
|
|||
server.recentPerformance.completion.add(completionPerformance);
|
||||
|
||||
var analysisSession = resolvedUnit.analysisSession;
|
||||
var enclosingNode =
|
||||
resolvedUnit.resolvedNodes.lastOrNull ?? resolvedUnit.parsedUnit;
|
||||
var enclosingNode = resolvedUnit.parsedUnit;
|
||||
|
||||
var completionRequest = DartCompletionRequest(
|
||||
analysisSession: analysisSession,
|
||||
|
|
Loading…
Reference in a new issue