Add optionalReplacementSpan to completions response (#40347)

* Add optionalReplacementRange to completions response

* Get the name right

* Fix unit tests

* Fix comment typo

* Fix comment typo

* Baseline
This commit is contained in:
Andrew Branch
2020-09-04 13:09:52 -07:00
committed by GitHub
parent 8384018e68
commit f6f2d36ee3
13 changed files with 76 additions and 5 deletions

View File

@@ -2256,6 +2256,12 @@ namespace ts.server.protocol {
readonly isGlobalCompletion: boolean;
readonly isMemberCompletion: boolean;
readonly isNewIdentifierLocation: boolean;
/**
* In the absence of `CompletionEntry["replacementSpan"]`, the editor may choose whether to use
* this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span
* must be used to commit that completion entry.
*/
readonly optionalReplacementSpan?: TextSpan;
readonly entries: readonly CompletionEntry[];
}

View File

@@ -1783,6 +1783,7 @@ namespace ts.server {
const res: protocol.CompletionInfo = {
...completions,
optionalReplacementSpan: completions.optionalReplacementSpan && toProtocolTextSpan(completions.optionalReplacementSpan, scriptInfo),
entries,
};
return res;