Permalink
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (24 sloc) 1.12 KB
<?
maxDescriptionLength = 70;
command = docfile.javadoc[0];
description = command.description.replace(/\n/g, '');
description = 'WebdriverIO - ' + description;
description = description.length < maxDescriptionLength ? description + Array(maxDescriptionLength - description.length + 4).join(' ') : description.substr(0, maxDescriptionLength) + '...';
description = description.replace(/</g, '&lt;').replace(/>/g, '&gt;');
commandName = docfile.filename.slice(0,-3);
?><snippet>
<content><![CDATA[<?= commandName ?>(<?
if(command.paramTags) {
command.paramTags.forEach(function(paramTag, i) {
var name = paramTag.name.replace(/\[|\]/g,'');
var comma = i < command.paramTags.length - 1 ? ', ' : '';
var sqm = paramTag.joinedTypes.indexOf('String') > -1 ? "'" : '';
sqm = paramTag.joinedTypes.indexOf('Function') > -1 ? "" : sqm;
?><?= sqm ?>${<?= ++i ?>:<?= name ?>}<?= sqm ?><?= comma ?><?
});
}
?>)${<?= command.paramTags.length + 1 ?>:]]></content>
<tabTrigger><?= commandName ?></tabTrigger>
<scope>source.js</scope>
<description><?= description ?></description>
</snippet>