Support a 'recommended' completion entry (#20020)

* Support a 'recommended' completion entry

* Code review

* Restore duplicate comments
This commit is contained in:
Andy
2017-12-01 13:00:01 -08:00
committed by GitHub
parent 973cb767c7
commit fd4d8ab96e
17 changed files with 235 additions and 62 deletions

View File

@@ -180,14 +180,15 @@ namespace ts.server {
isGlobalCompletion: false,
isMemberCompletion: false,
isNewIdentifierLocation: false,
entries: response.body.map(entry => {
entries: response.body.map<CompletionEntry>(entry => {
if (entry.replacementSpan !== undefined) {
const { name, kind, kindModifiers, sortText, replacementSpan } = entry;
return { name, kind, kindModifiers, sortText, replacementSpan: this.decodeSpan(replacementSpan, fileName) };
const { name, kind, kindModifiers, sortText, replacementSpan, hasAction, source, isRecommended } = entry;
// TODO: GH#241
const res: CompletionEntry = { name, kind, kindModifiers, sortText, replacementSpan: this.decodeSpan(replacementSpan, fileName), hasAction, source, isRecommended };
return res;
}
return entry as { name: string, kind: ScriptElementKind, kindModifiers: string, sortText: string };
return entry as { name: string, kind: ScriptElementKind, kindModifiers: string, sortText: string }; // TODO: GH#18217
})
};
}