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>
diff --git a/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions2.dart b/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions2.dart
index fd4f85c..0fbc2f7 100644
--- a/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions2.dart
+++ b/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions2.dart
@@ -24,7 +24,6 @@
 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 @@
         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,