提交 29999722 编写于 作者: M Matt Bierner

Don't include object key types in completeFunctionCalls

Fixes #66297
上级 45b836d0
...@@ -117,4 +117,12 @@ suite('typescript function call snippets', () => { ...@@ -117,4 +117,12 @@ suite('typescript function call snippets', () => {
'\\$abc()$0'); '\\$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');
});
}); });
...@@ -68,7 +68,7 @@ function getParameterListParts( ...@@ -68,7 +68,7 @@ function getParameterListParts(
break; break;
case PConst.DisplayPartKind.parameterName: case PConst.DisplayPartKind.parameterName:
if (parenCount === 1 && isInMethod) { if (parenCount === 1 && braceCount === 0 && isInMethod) {
// Only take top level paren names // Only take top level paren names
const next = displayParts[i + 1]; const next = displayParts[i + 1];
// Skip optional parameters // Skip optional parameters
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册