diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html index 4e9864a908a..7b198894a9d 100644 --- a/pkg/analysis_server/doc/api.html +++ b/pkg/analysis_server/doc/api.html @@ -3116,6 +3116,7 @@ a:focus, a:hover { +
AddContentOverlay: object
@@ -3479,6 +3480,27 @@ a:focus, a:hover { The label associated with this range that should be displayed to the user.

+
CompletionCaseMatchingMode: String
+

+ An enumeration of the character case matching modes that the user may set in the client. +

+ +
FIRST_CHAR
+ +

+ Match the first character case only when filtering completions, the default for this + enumeration. +

+
ALL_CHARS
+ +

+ Match all character cases when filtering completion lists. +

+
NONE
+ +

+ Do not match character cases when filtering completion lists. +

CompletionId: String

@@ -6116,7 +6138,7 @@ a:focus, a:hover { TODO: TBD

Index

-

Domains

server ()

Requests
Notifications

analysis ()

Requests
Notifications

completion ()

Requests
Notifications

search ()

Requests
Notifications

edit ()

Requests

execution ()

Requests
Notifications

diagnostic ()

Requests

flutter ()

Requests
Notifications

Types ()

Refactorings ()

+

Domains

server ()

Requests
Notifications

analysis ()

Requests
Notifications

completion ()

Requests
Notifications

search ()

Requests
Notifications

edit ()

Requests

execution ()

Requests
Notifications

diagnostic ()

Requests

flutter ()

Requests
Notifications

Types ()

Refactorings ()

\ No newline at end of file diff --git a/pkg/analysis_server/lib/protocol/protocol_constants.dart b/pkg/analysis_server/lib/protocol/protocol_constants.dart index 3baa9469210..6847dd0b395 100644 --- a/pkg/analysis_server/lib/protocol/protocol_constants.dart +++ b/pkg/analysis_server/lib/protocol/protocol_constants.dart @@ -138,6 +138,8 @@ const String COMPLETION_NOTIFICATION_RESULTS_REPLACEMENT_OFFSET = const String COMPLETION_NOTIFICATION_RESULTS_RESULTS = 'results'; const String COMPLETION_REQUEST_GET_SUGGESTIONS = 'completion.getSuggestions'; const String COMPLETION_REQUEST_GET_SUGGESTIONS2 = 'completion.getSuggestions2'; +const String COMPLETION_REQUEST_GET_SUGGESTIONS2_COMPLETION_CASE_MATCHING_MODE = + 'completionCaseMatchingMode'; const String COMPLETION_REQUEST_GET_SUGGESTIONS2_COMPLETION_MODE = 'completionMode'; const String COMPLETION_REQUEST_GET_SUGGESTIONS2_FILE = 'file'; diff --git a/pkg/analysis_server/lib/protocol/protocol_generated.dart b/pkg/analysis_server/lib/protocol/protocol_generated.dart index 98395e92e8f..d5a90a6607f 100644 --- a/pkg/analysis_server/lib/protocol/protocol_generated.dart +++ b/pkg/analysis_server/lib/protocol/protocol_generated.dart @@ -4215,6 +4215,68 @@ class CompletionAvailableSuggestionsParams implements HasToJson { ); } +/// CompletionCaseMatchingMode +/// +/// enum { +/// FIRST_CHAR +/// ALL_CHARS +/// NONE +/// } +/// +/// Clients may not extend, implement or mix-in this class. +class CompletionCaseMatchingMode implements Enum { + /// Match the first character case only when filtering completions, the + /// default for this enumeration. + static const CompletionCaseMatchingMode FIRST_CHAR = + CompletionCaseMatchingMode._('FIRST_CHAR'); + + /// Match all character cases when filtering completion lists. + static const CompletionCaseMatchingMode ALL_CHARS = + CompletionCaseMatchingMode._('ALL_CHARS'); + + /// Do not match character cases when filtering completion lists. + static const CompletionCaseMatchingMode NONE = + CompletionCaseMatchingMode._('NONE'); + + /// A list containing all of the enum values that are defined. + static const List VALUES = + [FIRST_CHAR, ALL_CHARS, NONE]; + + @override + final String name; + + const CompletionCaseMatchingMode._(this.name); + + factory CompletionCaseMatchingMode(String name) { + switch (name) { + case 'FIRST_CHAR': + return FIRST_CHAR; + case 'ALL_CHARS': + return ALL_CHARS; + case 'NONE': + return NONE; + } + throw Exception('Illegal enum value: $name'); + } + + factory CompletionCaseMatchingMode.fromJson( + JsonDecoder jsonDecoder, String jsonPath, Object? json) { + if (json is String) { + try { + return CompletionCaseMatchingMode(json); + } catch (_) { + // Fall through + } + } + throw jsonDecoder.mismatch(jsonPath, 'CompletionCaseMatchingMode', json); + } + + @override + String toString() => 'CompletionCaseMatchingMode.$name'; + + String toJson() => name; +} + /// completion.existingImports params /// /// { @@ -4683,6 +4745,7 @@ class CompletionGetSuggestionDetailsResult implements ResponseResult { /// "file": FilePath /// "offset": int /// "maxResults": int +/// "completionCaseMatchingMode": optional CompletionCaseMatchingMode /// } /// /// Clients may not extend, implement or mix-in this class. @@ -4698,6 +4761,10 @@ class CompletionGetSuggestions2Params implements RequestParams { /// to true. int maxResults; + /// The mode of code completion being invoked. If no value is provided, + /// MATCH_FIRST_CHAR will be assumed. + CompletionCaseMatchingMode? completionCaseMatchingMode; + /// The mode of code completion being invoked. If no value is provided, BASIC /// will be assumed. BASIC is also the only currently supported. CompletionMode? completionMode; @@ -4714,7 +4781,10 @@ class CompletionGetSuggestions2Params implements RequestParams { int? timeout; CompletionGetSuggestions2Params(this.file, this.offset, this.maxResults, - {this.completionMode, this.invocationCount, this.timeout}); + {this.completionCaseMatchingMode, + this.completionMode, + this.invocationCount, + this.timeout}); factory CompletionGetSuggestions2Params.fromJson( JsonDecoder jsonDecoder, String jsonPath, Object? json) { @@ -4739,6 +4809,13 @@ class CompletionGetSuggestions2Params implements RequestParams { } else { throw jsonDecoder.mismatch(jsonPath, 'maxResults'); } + CompletionCaseMatchingMode? completionCaseMatchingMode; + if (json.containsKey('completionCaseMatchingMode')) { + completionCaseMatchingMode = CompletionCaseMatchingMode.fromJson( + jsonDecoder, + jsonPath + '.completionCaseMatchingMode', + json['completionCaseMatchingMode']); + } CompletionMode? completionMode; if (json.containsKey('completionMode')) { completionMode = CompletionMode.fromJson( @@ -4754,6 +4831,7 @@ class CompletionGetSuggestions2Params implements RequestParams { timeout = jsonDecoder.decodeInt(jsonPath + '.timeout', json['timeout']); } return CompletionGetSuggestions2Params(file, offset, maxResults, + completionCaseMatchingMode: completionCaseMatchingMode, completionMode: completionMode, invocationCount: invocationCount, timeout: timeout); @@ -4774,6 +4852,11 @@ class CompletionGetSuggestions2Params implements RequestParams { result['file'] = file; result['offset'] = offset; result['maxResults'] = maxResults; + var completionCaseMatchingMode = this.completionCaseMatchingMode; + if (completionCaseMatchingMode != null) { + result['completionCaseMatchingMode'] = + completionCaseMatchingMode.toJson(); + } var completionMode = this.completionMode; if (completionMode != null) { result['completionMode'] = completionMode.toJson(); @@ -4803,6 +4886,7 @@ class CompletionGetSuggestions2Params implements RequestParams { return file == other.file && offset == other.offset && maxResults == other.maxResults && + completionCaseMatchingMode == other.completionCaseMatchingMode && completionMode == other.completionMode && invocationCount == other.invocationCount && timeout == other.timeout; @@ -4815,6 +4899,7 @@ class CompletionGetSuggestions2Params implements RequestParams { file, offset, maxResults, + completionCaseMatchingMode, completionMode, invocationCount, timeout, diff --git a/pkg/analysis_server/test/integration/support/integration_test_methods.dart b/pkg/analysis_server/test/integration/support/integration_test_methods.dart index c12b23d68da..fddcbfab821 100644 --- a/pkg/analysis_server/test/integration/support/integration_test_methods.dart +++ b/pkg/analysis_server/test/integration/support/integration_test_methods.dart @@ -993,6 +993,11 @@ abstract class IntegrationTestMixin { /// suggestions after filtering is greater than the maxResults, then /// isIncomplete is set to true. /// + /// completionCaseMatchingMode: CompletionCaseMatchingMode (optional) + /// + /// The mode of code completion being invoked. If no value is provided, + /// MATCH_FIRST_CHAR will be assumed. + /// /// Returns /// /// replacementOffset: int @@ -1029,10 +1034,12 @@ abstract class IntegrationTestMixin { /// requested maxResults. Future sendCompletionGetSuggestions2( String file, int offset, int maxResults, - {CompletionMode? completionMode, + {CompletionCaseMatchingMode? completionCaseMatchingMode, + CompletionMode? completionMode, int? invocationCount, int? timeout}) async { var params = CompletionGetSuggestions2Params(file, offset, maxResults, + completionCaseMatchingMode: completionCaseMatchingMode, completionMode: completionMode, invocationCount: invocationCount, timeout: timeout) diff --git a/pkg/analysis_server/test/integration/support/protocol_matchers.dart b/pkg/analysis_server/test/integration/support/protocol_matchers.dart index 3e1ed40ef48..ddf2b9b836d 100644 --- a/pkg/analysis_server/test/integration/support/protocol_matchers.dart +++ b/pkg/analysis_server/test/integration/support/protocol_matchers.dart @@ -230,6 +230,16 @@ final Matcher isChangeContentOverlay = LazyMatcher(() => MatchesJsonObject( final Matcher isClosingLabel = LazyMatcher(() => MatchesJsonObject( 'ClosingLabel', {'offset': isInt, 'length': isInt, 'label': isString})); +/// CompletionCaseMatchingMode +/// +/// enum { +/// FIRST_CHAR +/// ALL_CHARS +/// NONE +/// } +final Matcher isCompletionCaseMatchingMode = MatchesEnum( + 'CompletionCaseMatchingMode', ['FIRST_CHAR', 'ALL_CHARS', 'NONE']); + /// CompletionId /// /// String @@ -2148,17 +2158,19 @@ final Matcher isCompletionGetSuggestionDetailsResult = LazyMatcher(() => /// "file": FilePath /// "offset": int /// "maxResults": int +/// "completionCaseMatchingMode": optional CompletionCaseMatchingMode /// } -final Matcher isCompletionGetSuggestions2Params = LazyMatcher(() => - MatchesJsonObject('completion.getSuggestions2 params', { - 'file': isFilePath, - 'offset': isInt, - 'maxResults': isInt - }, optionalFields: { - 'completionMode': isCompletionMode, - 'invocationCount': isInt, - 'timeout': isInt - })); +final Matcher isCompletionGetSuggestions2Params = + LazyMatcher(() => MatchesJsonObject('completion.getSuggestions2 params', { + 'file': isFilePath, + 'offset': isInt, + 'maxResults': isInt + }, optionalFields: { + 'completionCaseMatchingMode': isCompletionCaseMatchingMode, + 'completionMode': isCompletionMode, + 'invocationCount': isInt, + 'timeout': isInt + })); /// completion.getSuggestions2 result /// diff --git a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java index 3d8e563d784..59da9532397 100644 --- a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java +++ b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java @@ -440,6 +440,8 @@ public interface AnalysisServer { * @param offset The offset within the file at which suggestions are to be made. * @param maxResults The maximum number of suggestions to return. If the number of suggestions * after filtering is greater than the maxResults, then isIncomplete is set to true. + * @param completionCaseMatchingMode The mode of code completion being invoked. If no value is + * provided, MATCH_FIRST_CHAR will be assumed. * @param completionMode The mode of code completion being invoked. If no value is provided, BASIC * will be assumed. BASIC is also the only currently supported. * @param invocationCount The number of times that the user has invoked code completion at the same @@ -449,7 +451,7 @@ public interface AnalysisServer { * field is intended to be used for benchmarking, and usually should not be provided, so * that the default timeout is used. */ - public void completion_getSuggestions2(String file, int offset, int maxResults, String completionMode, int invocationCount, int timeout, GetSuggestions2Consumer consumer); + public void completion_getSuggestions2(String file, int offset, int maxResults, String completionCaseMatchingMode, String completionMode, int invocationCount, int timeout, GetSuggestions2Consumer consumer); /** * {@code completion.registerLibraryPaths} diff --git a/pkg/analysis_server/tool/spec/generated/java/types/CompletionCaseMatchingMode.java b/pkg/analysis_server/tool/spec/generated/java/types/CompletionCaseMatchingMode.java new file mode 100644 index 00000000000..3a4dc2a2616 --- /dev/null +++ b/pkg/analysis_server/tool/spec/generated/java/types/CompletionCaseMatchingMode.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file + * for details. All rights reserved. Use of this source code is governed by a + * BSD-style license that can be found in the LICENSE file. + * + * This file has been automatically generated. Please do not edit it manually. + * To regenerate the file, use the script "pkg/analysis_server/tool/spec/generate_files". + */ +package org.dartlang.analysis.server.protocol; + +/** + * An enumeration of the character case matching modes that the user may set in the client. + * + * @coverage dart.server.generated.types + */ +public class CompletionCaseMatchingMode { + + /** + * Match the first character case only when filtering completions, the default for this + * enumeration. + */ + public static final String FIRST_CHAR = "FIRST_CHAR"; + + /** + * Match all character cases when filtering completion lists. + */ + public static final String ALL_CHARS = "ALL_CHARS"; + + /** + * Do not match character cases when filtering completion lists. + */ + public static final String NONE = "NONE"; + +} diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html index 51f35a41f41..72108711e3c 100644 --- a/pkg/analysis_server/tool/spec/spec_input.html +++ b/pkg/analysis_server/tool/spec/spec_input.html @@ -1507,6 +1507,13 @@ then isIncomplete is set to true.

+ + CompletionCaseMatchingMode +

+ The mode of code completion being invoked. If no value is provided, + MATCH_FIRST_CHAR will be assumed. +

+
CompletionMode

@@ -4146,6 +4153,32 @@ + +

+ An enumeration of the character case matching modes that the user may set in the client. +

+ + + FIRST_CHAR +

+ Match the first character case only when filtering completions, the default for this + enumeration. +

+
+ + ALL_CHARS +

+ Match all character cases when filtering completion lists. +

+
+ + NONE +

+ Do not match character cases when filtering completion lists. +

+
+
+

An expression for which we want to know its runtime type. diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart index 3baa9469210..6847dd0b395 100644 --- a/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart +++ b/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart @@ -138,6 +138,8 @@ const String COMPLETION_NOTIFICATION_RESULTS_REPLACEMENT_OFFSET = const String COMPLETION_NOTIFICATION_RESULTS_RESULTS = 'results'; const String COMPLETION_REQUEST_GET_SUGGESTIONS = 'completion.getSuggestions'; const String COMPLETION_REQUEST_GET_SUGGESTIONS2 = 'completion.getSuggestions2'; +const String COMPLETION_REQUEST_GET_SUGGESTIONS2_COMPLETION_CASE_MATCHING_MODE = + 'completionCaseMatchingMode'; const String COMPLETION_REQUEST_GET_SUGGESTIONS2_COMPLETION_MODE = 'completionMode'; const String COMPLETION_REQUEST_GET_SUGGESTIONS2_FILE = 'file'; diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart index 413c5511062..484915efad3 100644 --- a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart +++ b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart @@ -4215,6 +4215,68 @@ class CompletionAvailableSuggestionsParams implements HasToJson { ); } +/// CompletionCaseMatchingMode +/// +/// enum { +/// FIRST_CHAR +/// ALL_CHARS +/// NONE +/// } +/// +/// Clients may not extend, implement or mix-in this class. +class CompletionCaseMatchingMode implements Enum { + /// Match the first character case only when filtering completions, the + /// default for this enumeration. + static const CompletionCaseMatchingMode FIRST_CHAR = + CompletionCaseMatchingMode._('FIRST_CHAR'); + + /// Match all character cases when filtering completion lists. + static const CompletionCaseMatchingMode ALL_CHARS = + CompletionCaseMatchingMode._('ALL_CHARS'); + + /// Do not match character cases when filtering completion lists. + static const CompletionCaseMatchingMode NONE = + CompletionCaseMatchingMode._('NONE'); + + /// A list containing all of the enum values that are defined. + static const List VALUES = + [FIRST_CHAR, ALL_CHARS, NONE]; + + @override + final String name; + + const CompletionCaseMatchingMode._(this.name); + + factory CompletionCaseMatchingMode(String name) { + switch (name) { + case 'FIRST_CHAR': + return FIRST_CHAR; + case 'ALL_CHARS': + return ALL_CHARS; + case 'NONE': + return NONE; + } + throw Exception('Illegal enum value: $name'); + } + + factory CompletionCaseMatchingMode.fromJson( + JsonDecoder jsonDecoder, String jsonPath, Object? json) { + if (json is String) { + try { + return CompletionCaseMatchingMode(json); + } catch (_) { + // Fall through + } + } + throw jsonDecoder.mismatch(jsonPath, 'CompletionCaseMatchingMode', json); + } + + @override + String toString() => 'CompletionCaseMatchingMode.$name'; + + String toJson() => name; +} + /// completion.existingImports params /// /// { @@ -4683,6 +4745,7 @@ class CompletionGetSuggestionDetailsResult implements ResponseResult { /// "file": FilePath /// "offset": int /// "maxResults": int +/// "completionCaseMatchingMode": optional CompletionCaseMatchingMode /// } /// /// Clients may not extend, implement or mix-in this class. @@ -4698,6 +4761,10 @@ class CompletionGetSuggestions2Params implements RequestParams { /// to true. int maxResults; + /// The mode of code completion being invoked. If no value is provided, + /// MATCH_FIRST_CHAR will be assumed. + CompletionCaseMatchingMode? completionCaseMatchingMode; + /// The mode of code completion being invoked. If no value is provided, BASIC /// will be assumed. BASIC is also the only currently supported. CompletionMode? completionMode; @@ -4714,7 +4781,10 @@ class CompletionGetSuggestions2Params implements RequestParams { int? timeout; CompletionGetSuggestions2Params(this.file, this.offset, this.maxResults, - {this.completionMode, this.invocationCount, this.timeout}); + {this.completionCaseMatchingMode, + this.completionMode, + this.invocationCount, + this.timeout}); factory CompletionGetSuggestions2Params.fromJson( JsonDecoder jsonDecoder, String jsonPath, Object? json) { @@ -4739,6 +4809,13 @@ class CompletionGetSuggestions2Params implements RequestParams { } else { throw jsonDecoder.mismatch(jsonPath, 'maxResults'); } + CompletionCaseMatchingMode? completionCaseMatchingMode; + if (json.containsKey('completionCaseMatchingMode')) { + completionCaseMatchingMode = CompletionCaseMatchingMode.fromJson( + jsonDecoder, + jsonPath + '.completionCaseMatchingMode', + json['completionCaseMatchingMode']); + } CompletionMode? completionMode; if (json.containsKey('completionMode')) { completionMode = CompletionMode.fromJson( @@ -4754,6 +4831,7 @@ class CompletionGetSuggestions2Params implements RequestParams { timeout = jsonDecoder.decodeInt(jsonPath + '.timeout', json['timeout']); } return CompletionGetSuggestions2Params(file, offset, maxResults, + completionCaseMatchingMode: completionCaseMatchingMode, completionMode: completionMode, invocationCount: invocationCount, timeout: timeout); @@ -4774,6 +4852,11 @@ class CompletionGetSuggestions2Params implements RequestParams { result['file'] = file; result['offset'] = offset; result['maxResults'] = maxResults; + var completionCaseMatchingMode = this.completionCaseMatchingMode; + if (completionCaseMatchingMode != null) { + result['completionCaseMatchingMode'] = + completionCaseMatchingMode.toJson(); + } var completionMode = this.completionMode; if (completionMode != null) { result['completionMode'] = completionMode.toJson(); @@ -4803,6 +4886,7 @@ class CompletionGetSuggestions2Params implements RequestParams { return file == other.file && offset == other.offset && maxResults == other.maxResults && + completionCaseMatchingMode == other.completionCaseMatchingMode && completionMode == other.completionMode && invocationCount == other.invocationCount && timeout == other.timeout; @@ -4815,6 +4899,7 @@ class CompletionGetSuggestions2Params implements RequestParams { file, offset, maxResults, + completionCaseMatchingMode, completionMode, invocationCount, timeout,