Treat any non-whitespace character as jsdoc param names

Fixes #90108
This commit is contained in:
Matt Bierner 2020-02-05 15:18:01 -08:00
parent 4cc5b776dc
commit 5347c21ecf
2 changed files with 12 additions and 2 deletions

View file

@ -54,5 +54,15 @@ suite('typescript.previewer', () => {
'x {@link http://www.example.com/foo y [bar](http://www.example.com/bar) z');
});
test('Should support non-ascii characters in paramter name (#90108)', async () => {
assert.strictEqual(
tagsMarkdownPreview([
{
name: 'param',
text: 'parámetroConDiacríticos this will not'
}
]),
'*@param* `parámetroConDiacríticos` — this will not');
});
});

View file

@ -68,8 +68,8 @@ function getTagDocumentation(tag: Proto.JSDocTagInfo): string | undefined {
case 'extends':
case 'param':
case 'template':
const body = (tag.text || '').split(/^([\w\.]+)\s*-?\s*/);
if (body && body.length === 3) {
const body = (tag.text || '').split(/^(\S+)\s*-?\s*/);
if (body?.length === 3) {
const param = body[1];
const doc = body[2];
const label = `*@${tag.name}* \`${param}\``;