Skip to content

Commit

Permalink
Version 3.5.0-321.0.dev
Browse files Browse the repository at this point in the history
Merge 3370a4e into dev
  • Loading branch information
Dart CI committed Jul 1, 2024
2 parents 21c0874 + 3370a4e commit c23e581
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 275 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ vars = {
"path_rev": "04807b61c25f98f328b322ec511451f9f86f98bb",
"pool_rev": "832c5ab5eaee444354a8c796f7998bf744f169af",
"protobuf_rev": "ccf104dbc36929c0f8708285d5f3a8fae206343e",
"pub_rev": "ddc1c2fd2e2a7cd94a0b92ea033961a25f4ad517", # disable tools/rev_sdk_deps.dart
"pub_rev": "ea4a1c854690d3abceb92c8cc2c6454470f9d5a7", # disable tools/rev_sdk_deps.dart
"pub_semver_rev": "dfcad38866fb1e94e8ca91bff3dddd5189fb0794",
"shelf_rev": "2536c15a562cb183dabbc628824a215663830325",
"source_map_stack_trace_rev": "96a8213dacf7cd42aefb1311491a4169826f98d2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1000,10 +1000,11 @@ extension SuggestionBuilderExtension on SuggestionBuilder {
}

/// Add a suggestion for each of the candidate [suggestions].
Future<void> suggestFromCandidates(
List<CandidateSuggestion> suggestions, bool preferConstants) async {
Future<void> suggestFromCandidates(List<CandidateSuggestion> suggestions,
bool preferConstants, String? completionLocation) async {
relevanceComputer.preferConstants =
preferConstants || request.inConstantContext;
relevanceComputer.completionLocation = completionLocation;
for (var suggestion in suggestions) {
await suggestFromCandidate(suggestion);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ class DartCompletionManager {

var builder =
SuggestionBuilder(request, useFilter: useFilter, listener: listener);
await builder.suggestFromCandidates(
collector.suggestions, collector.preferConstants);
await builder.suggestFromCandidates(collector.suggestions,
collector.preferConstants, collector.completionLocation);

var notImportedSuggestions = this.notImportedSuggestions;

if (notImportedSuggestions != null && collector.isIncomplete) {
notImportedSuggestions.isIncomplete = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class RelevanceComputer {
/// computed. In the latter case, [_hasContainingMemberName] will be `false`.
String? _cachedContainingMemberName;

/// A textual representation of the location at which completion was
/// requested.
String? completionLocation;

RelevanceComputer(this.request, this.listener)
: featureComputer = request.featureComputer;

Expand Down Expand Up @@ -323,8 +327,7 @@ class RelevanceComputer {
/// Compute the value of the _element kind_ feature for the given [element] in
/// the completion context.
double _computeElementKind(Element element, {double? distance}) {
// TODO(keertip): Use completionLocation from SuggestionCollector.
var location = request.opType.completionLocation;
var location = completionLocation;
var elementKind = featureComputer.elementKindFeature(element, location,
distance: distance);
if (elementKind < 0.0) {
Expand Down Expand Up @@ -381,9 +384,8 @@ class RelevanceComputer {
}
var contextType =
featureComputer.contextTypeFeature(request.contextType, elementType);
// TODO(keertip): Use completionLocation from SuggestionCollector.
var keywordFeature = featureComputer.keywordFeature(
keyword, request.opType.completionLocation);
var keywordFeature =
featureComputer.keywordFeature(keyword, completionLocation);
return computeScore(
contextType: contextType,
keyword: keywordFeature,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1920,12 +1920,10 @@ replacement
suggestions
final
kind: keyword
static
kind: keyword
void
kind: keyword
const
kind: keyword
var
kind: keyword
abstract
kind: keyword
covariant
Expand All @@ -1936,7 +1934,9 @@ suggestions
kind: keyword
late
kind: keyword
var
static
kind: keyword
void
kind: keyword
''');
}
Expand Down Expand Up @@ -2341,20 +2341,20 @@ class X {dynamic f(a,b,c) {return a + b * c ^;}}
''');
assertResponse(r'''
suggestions
const
true
kind: keyword
null
kind: keyword
false
kind: keyword
null
this
kind: keyword
const
kind: keyword
super
kind: keyword
switch
kind: keyword
this
kind: keyword
true
kind: keyword
''');
}

Expand Down Expand Up @@ -4640,42 +4640,42 @@ class x {}^
''');
assertResponse(r'''
suggestions
abstract
kind: keyword
base
kind: keyword
class
kind: keyword
num
kind: class
const
kind: keyword
covariant
void
kind: keyword
dynamic
final
kind: keyword
enum
kind: keyword
typedef
kind: keyword
abstract
kind: keyword
base
kind: keyword
covariant
kind: keyword
dynamic
kind: keyword
extension
kind: keyword
external
kind: keyword
final
kind: keyword
interface
kind: keyword
late
kind: keyword
mixin
kind: keyword
num
kind: class
sealed
kind: keyword
typedef
kind: keyword
var
kind: keyword
void
kind: keyword
''');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4202,14 +4202,14 @@ void f() {
suggestions
S0
kind: localVariable
String
kind: class
String.fromCharCode
kind: constructorInvocation
String.fromCharCodes
kind: constructorInvocation
String.fromEnvironment
kind: constructorInvocation
String
kind: class
''');
}

Expand Down Expand Up @@ -4280,10 +4280,14 @@ foo = {^
suggestions
C0
kind: class
C0
kind: constructorInvocation
C1
kind: class
T0
kind: topLevelVariable
T1
kind: topLevelVariable
C0
kind: constructorInvocation
C1
kind: constructorInvocation
D0
Expand All @@ -4294,10 +4298,6 @@ suggestions
kind: functionInvocation
F1
kind: functionInvocation
T0
kind: topLevelVariable
T1
kind: topLevelVariable
''');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5133,10 +5133,14 @@ foo = {^
suggestions
C0
kind: class
C0
kind: constructorInvocation
C1
kind: class
T0
kind: topLevelVariable
T1
kind: topLevelVariable
C0
kind: constructorInvocation
C1
kind: constructorInvocation
D0
Expand All @@ -5147,10 +5151,6 @@ suggestions
kind: functionInvocation
F1
kind: functionInvocation
T0
kind: topLevelVariable
T1
kind: topLevelVariable
''');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3302,10 +3302,14 @@ foo = {^
suggestions
C0
kind: class
C0
kind: constructorInvocation
C1
kind: class
T0
kind: topLevelVariable
T1
kind: topLevelVariable
C0
kind: constructorInvocation
C1
kind: constructorInvocation
D0
Expand All @@ -3316,10 +3320,6 @@ suggestions
kind: functionInvocation
F1
kind: functionInvocation
T0
kind: topLevelVariable
T1
kind: topLevelVariable
''');
}

Expand Down
Loading

0 comments on commit c23e581

Please sign in to comment.