Don't include object key types in completeFunctionCalls

Fixes #66297
This commit is contained in:
Matt Bierner
2019-01-09 11:50:43 -08:00
parent 45b836d0b9
commit 299997228d
2 changed files with 9 additions and 1 deletions

View File

@@ -117,4 +117,12 @@ suite('typescript function call snippets', () => {
'\\$abc()$0');
});
test('Should not include object key signature in completion, #66297', async () => {
assert.strictEqual(
snippetForFunctionCall(
{ label: 'foobar', },
[{ "text": "function", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "foobar", "kind": "functionName" }, { "text": "(", "kind": "punctuation" }, { "text": "param", "kind": "parameterName" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "{", "kind": "punctuation" }, { "text": "\n", "kind": "lineBreak" }, { "text": " ", "kind": "space" }, { "text": "[", "kind": "punctuation" }, { "text": "key", "kind": "parameterName" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "string", "kind": "keyword" }, { "text": "]", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "string", "kind": "keyword" }, { "text": ";", "kind": "punctuation" }, { "text": "\n", "kind": "lineBreak" }, { "text": "}", "kind": "punctuation" }, { "text": ")", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "void", "kind": "keyword" }]
).snippet.value,
'foobar(${1:param})$0');
});
});

View File

@@ -68,7 +68,7 @@ function getParameterListParts(
break;
case PConst.DisplayPartKind.parameterName:
if (parenCount === 1 && isInMethod) {
if (parenCount === 1 && braceCount === 0 && isInMethod) {
// Only take top level paren names
const next = displayParts[i + 1];
// Skip optional parameters