Don't include this function types in completeFunctionCalls (#104479)
This commit is contained in:
parent
650f7688f3
commit
63c711deef
|
@ -128,4 +128,13 @@ suite('typescript function call snippets', () => {
|
||||||
).snippet.value,
|
).snippet.value,
|
||||||
'foobar(${1:param})$0');
|
'foobar(${1:param})$0');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Should skip over this parameter', async () => {
|
||||||
|
assert.strictEqual(
|
||||||
|
snippetForFunctionCall(
|
||||||
|
{ label: 'foobar', },
|
||||||
|
[{ "text": "function", "kind": "keyword" }, { "text": " ", "kind": "space" }, { "text": "foobar", "kind": "functionName" }, { "text": "(", "kind": "punctuation" }, { "text": "this", "kind": "parameterName" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "string", "kind": "keyword" }, { "text": ",", "kind": "punctuation" }, { "text": "param", "kind": "parameterName" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "string", "kind": "keyword" }, { "text": ")", "kind": "punctuation" }, { "text": ":", "kind": "punctuation" }, { "text": " ", "kind": "space" }, { "text": "void", "kind": "keyword" }]
|
||||||
|
).snippet.value,
|
||||||
|
'foobar(${1:param})$0');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -73,7 +73,9 @@ function getParameterListParts(
|
||||||
const next = displayParts[i + 1];
|
const next = displayParts[i + 1];
|
||||||
// Skip optional parameters
|
// Skip optional parameters
|
||||||
const nameIsFollowedByOptionalIndicator = next && next.text === '?';
|
const nameIsFollowedByOptionalIndicator = next && next.text === '?';
|
||||||
if (!nameIsFollowedByOptionalIndicator) {
|
// Skip this parameter
|
||||||
|
const nameIsThis = part.text === 'this';
|
||||||
|
if (!nameIsFollowedByOptionalIndicator && !nameIsThis) {
|
||||||
parts.push(part);
|
parts.push(part);
|
||||||
}
|
}
|
||||||
hasOptionalParameters = hasOptionalParameters || nameIsFollowedByOptionalIndicator;
|
hasOptionalParameters = hasOptionalParameters || nameIsFollowedByOptionalIndicator;
|
||||||
|
|
Loading…
Reference in a new issue