Skip to content

Commit

Permalink
fix(language-service): Use ts.CompletionEntry for completions (angula…
Browse files Browse the repository at this point in the history
…r#32375)

This is a prerequisite to fix a bug in template completions whereby
completion of the string `ti` for the variable `title` results in
`tititle`.

This is because the position where the completion is requested is used
to insert the completion text. This is incorrect. Instead, a
`replacementSpan` should be used to indicate the span of text that needs
to be replaced. Angular's own `Completion` interface is insufficient to
hold this information. Instead, we should just use ts.CompletionEntry.

Also added string enum for `CompletionKind`, which is similar to
ts.ScriptElementKind but contains more info about HTML entities.

PR Close angular#32375
  • Loading branch information
Keen Yee Liau authored and mhevery committed Sep 4, 2019
1 parent bdbf0c9 commit f6e88cd
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 134 deletions.
44 changes: 1 addition & 43 deletions integration/language_service_plugin/goldens/completionInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,255 +12,213 @@
{
"name": "anchor",
"kind": "method",
"kindModifiers": "",
"sortText": "anchor"
},
{
"name": "big",
"kind": "method",
"kindModifiers": "",
"sortText": "big"
},
{
"name": "blink",
"kind": "method",
"kindModifiers": "",
"sortText": "blink"
},
{
"name": "bold",
"kind": "method",
"kindModifiers": "",
"sortText": "bold"
},
{
"name": "charAt",
"kind": "method",
"kindModifiers": "",
"sortText": "charAt"
},
{
"name": "charCodeAt",
"kind": "method",
"kindModifiers": "",
"sortText": "charCodeAt"
},
{
"name": "codePointAt",
"kind": "method",
"kindModifiers": "",
"sortText": "codePointAt"
},
{
"name": "concat",
"kind": "method",
"kindModifiers": "",
"sortText": "concat"
},
{
"name": "endsWith",
"kind": "method",
"kindModifiers": "",
"sortText": "endsWith"
},
{
"name": "fixed",
"kind": "method",
"kindModifiers": "",
"sortText": "fixed"
},
{
"name": "fontcolor",
"kind": "method",
"kindModifiers": "",
"sortText": "fontcolor"
},
{
"name": "fontsize",
"kind": "method",
"kindModifiers": "",
"sortText": "fontsize"
},
{
"name": "includes",
"kind": "method",
"kindModifiers": "",
"sortText": "includes"
},
{
"name": "indexOf",
"kind": "method",
"kindModifiers": "",
"sortText": "indexOf"
},
{
"name": "italics",
"kind": "method",
"kindModifiers": "",
"sortText": "italics"
},
{
"name": "lastIndexOf",
"kind": "method",
"kindModifiers": "",
"sortText": "lastIndexOf"
},
{
"name": "length",
"kind": "property",
"kindModifiers": "",
"sortText": "length"
},
{
"name": "link",
"kind": "method",
"kindModifiers": "",
"sortText": "link"
},
{
"name": "localeCompare",
"kind": "method",
"kindModifiers": "",
"sortText": "localeCompare"
},
{
"name": "match",
"kind": "method",
"kindModifiers": "",
"sortText": "match"
},
{
"name": "normalize",
"kind": "method",
"kindModifiers": "",
"sortText": "normalize"
},
{
"name": "repeat",
"kind": "method",
"kindModifiers": "",
"sortText": "repeat"
},
{
"name": "replace",
"kind": "method",
"kindModifiers": "",
"sortText": "replace"
},
{
"name": "search",
"kind": "method",
"kindModifiers": "",
"sortText": "search"
},
{
"name": "slice",
"kind": "method",
"kindModifiers": "",
"sortText": "slice"
},
{
"name": "small",
"kind": "method",
"kindModifiers": "",
"sortText": "small"
},
{
"name": "split",
"kind": "method",
"kindModifiers": "",
"sortText": "split"
},
{
"name": "startsWith",
"kind": "method",
"kindModifiers": "",
"sortText": "startsWith"
},
{
"name": "strike",
"kind": "method",
"kindModifiers": "",
"sortText": "strike"
},
{
"name": "sub",
"kind": "method",
"kindModifiers": "",
"sortText": "sub"
},
{
"name": "substr",
"kind": "method",
"kindModifiers": "",
"sortText": "substr"
},
{
"name": "substring",
"kind": "method",
"kindModifiers": "",
"sortText": "substring"
},
{
"name": "sup",
"kind": "method",
"kindModifiers": "",
"sortText": "sup"
},
{
"name": "toLocaleLowerCase",
"kind": "method",
"kindModifiers": "",
"sortText": "toLocaleLowerCase"
},
{
"name": "toLocaleUpperCase",
"kind": "method",
"kindModifiers": "",
"sortText": "toLocaleUpperCase"
},
{
"name": "toLowerCase",
"kind": "method",
"kindModifiers": "",
"sortText": "toLowerCase"
},
{
"name": "toString",
"kind": "method",
"kindModifiers": "",
"sortText": "toString"
},
{
"name": "toUpperCase",
"kind": "method",
"kindModifiers": "",
"sortText": "toUpperCase"
},
{
"name": "trim",
"kind": "method",
"kindModifiers": "",
"sortText": "trim"
},
{
"name": "trimLeft",
"kind": "method",
"kindModifiers": "",
"sortText": "trimLeft"
},
{
"name": "trimRight",
"kind": "method",
"kindModifiers": "",
"sortText": "trimRight"
},
{
"name": "valueOf",
"kind": "method",
"kindModifiers": "",
"sortText": "valueOf"
}
]
}
}
}
Loading

0 comments on commit f6e88cd

Please sign in to comment.