| Index: pkg/analysis_server/lib/src/services/completion/completion_core.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/completion/completion_core.dart b/pkg/analysis_server/lib/src/services/completion/completion_core.dart
|
| index b65f4bf7c99550f1b21eff1c8b93667f6b0d4562..7048a6e99891650a582d61ae82a8bb11cf750756 100644
|
| --- a/pkg/analysis_server/lib/src/services/completion/completion_core.dart
|
| +++ b/pkg/analysis_server/lib/src/services/completion/completion_core.dart
|
| @@ -23,6 +23,22 @@ class CompletionRequestImpl implements CompletionRequest {
|
| @override
|
| final int offset;
|
|
|
| + /**
|
| + * The offset of the start of the text to be replaced.
|
| + * This will be different than the offset used to request the completion
|
| + * suggestions if there was a portion of an identifier before the original
|
| + * offset. In particular, the replacementOffset will be the offset of the
|
| + * beginning of said identifier.
|
| + */
|
| + int replacementOffset;
|
| +
|
| + /**
|
| + * The length of the text to be replaced if the remainder of the identifier
|
| + * containing the cursor is to be replaced when the suggestion is applied
|
| + * (that is, the number of characters in the existing identifier).
|
| + */
|
| + int replacementLength;
|
| +
|
| @override
|
| final ResourceProvider resourceProvider;
|
|
|
| @@ -33,5 +49,19 @@ class CompletionRequestImpl implements CompletionRequest {
|
| * Initialize a newly created completion request based on the given arguments.
|
| */
|
| CompletionRequestImpl(this.context, this.resourceProvider, this.searchEngine,
|
| - this.source, this.offset);
|
| + this.source, this.offset) {
|
| + replacementOffset = offset;
|
| + replacementLength = 0;
|
| + }
|
| +
|
| + /**
|
| + * Return the original text from the [replacementOffset] to the [offset]
|
| + * that can be used to filter the suggestions on the server side.
|
| + */
|
| + String get filterText {
|
| + return context
|
| + .getContents(source)
|
| + .data
|
| + .substring(replacementOffset, offset);
|
| + }
|
| }
|
|
|