Skip to content

Commit e573f64

Browse files
keertipCommit Queue
authored andcommitted
Create LSP CompletionItem from CandidateSuggestion, bypassing the SuggestionBuilder.
This eliminates the step of converting CandidateSuggestion to legacy completion item and then into LSP completion item. Also makes use of the SuggestionCollector to sort and truncate suggestions. The utility functions/methods are in completion_utils.dart, these are based on the code in mapping.dart, modified to use CandidateSuggestions. Change-Id: I1e44a5318575eeb3b89803e20a082f98b7bedd41 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392082 Commit-Queue: Keerti Parthasarathy <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 9f23661 commit e573f64

File tree

10 files changed

+852
-131
lines changed

10 files changed

+852
-131
lines changed

pkg/analysis_server/analyzer_use_new_elements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ lib/src/lsp/handlers/handler_cancel_request.dart
134134
lib/src/lsp/handlers/handler_change_workspace_folders.dart
135135
lib/src/lsp/handlers/handler_code_actions.dart
136136
lib/src/lsp/handlers/handler_code_lens.dart
137-
lib/src/lsp/handlers/handler_completion.dart
138137
lib/src/lsp/handlers/handler_dart_text_document_content_provider.dart
139138
lib/src/lsp/handlers/handler_document_color.dart
140139
lib/src/lsp/handlers/handler_document_highlights.dart

pkg/analysis_server/lib/plugin/protocol/protocol_dart.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Element convertElement(engine.Element element) {
1919
var name = getElementDisplayName(element);
2020
var elementTypeParameters = _getTypeParametersString(element);
2121
var aliasedType = getAliasedTypeString(element);
22-
var elementParameters = _getParametersString(element);
22+
var elementParameters = getParametersString(element);
2323
var elementReturnType = getReturnTypeString(element);
2424
return Element(
2525
kind,
@@ -188,7 +188,7 @@ String getElementDisplayName2(engine.Element2 element) {
188188
}
189189
}
190190

191-
String? _getParametersString(engine.Element element) {
191+
String? getParametersString(engine.Element element) {
192192
// TODO(scheglov): expose the corresponding feature from ExecutableElement
193193
List<engine.ParameterElement> parameters;
194194
if (element is engine.ExecutableElement) {

0 commit comments

Comments
 (0)