extensions/typescript-language-features/src/utils/snippetForFunctionCall.ts/snippetForFunctionCall
export function snippetForFunctionCall(
	item: { insertText?: string | vscode.SnippetString; label: string; },
	displayParts: ReadonlyArray<Proto.SymbolDisplayPart>
): { snippet: vscode.SnippetString, parameterCount: number } {
	if (item.insertText && typeof item.insertText !== 'string') {
		return { snippet: item.insertText, parameterCount: 0 };
	}

	const parameterListParts = getParameterListParts(displayParts);
	const snippet = new vscode.SnippetString();
	snippet.appendText(`${item.insertText || item.label}(`);
	appendJoinedPlaceholders(snippet, parameterListParts.parts, ', ');
	if (parameterListParts.hasOptionalParameters) {
		snippet.appendTabstop();
	}
	snippet.appendText(')');
	snippet.appendTabstop(0);
	return { snippet, parameterCount: parameterListParts.parts.length + (parameterListParts.hasOptionalParameters ? 1 : 0) };
}