mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
Fix a double dash in the previewer if an @param jsdoc tag has a hyphen after the param name (#53365)
* Fix a double dash if the @param has a hyphen * Moved into the other regex * Add test for ignoring hypen after @param * Fixed test and moved to previewer.test.ts
This commit is contained in:
committed by
Matt Bierner
parent
9989abf527
commit
8ab9119cf6
@@ -0,0 +1,22 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import { tagsMarkdownPreview } from '../utils/previewer';
|
||||
|
||||
suite('typescript.previewer', () => {
|
||||
test('Should ignore hyphens after a param tag', async () => {
|
||||
assert.strictEqual(
|
||||
tagsMarkdownPreview([
|
||||
{
|
||||
name: 'param',
|
||||
text: 'a - b'
|
||||
}
|
||||
]),
|
||||
'*@param* `a` — b');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ function getTagBodyText(tag: Proto.JSDocTagInfo): string | undefined {
|
||||
function getTagDocumentation(tag: Proto.JSDocTagInfo): string | undefined {
|
||||
switch (tag.name) {
|
||||
case 'param':
|
||||
const body = (tag.text || '').split(/^([\w\.]+)\s*/);
|
||||
const body = (tag.text || '').split(/^([\w\.]+)\s*-?\s*/);
|
||||
if (body && body.length === 3) {
|
||||
const param = body[1];
|
||||
const doc = body[2];
|
||||
@@ -81,4 +81,4 @@ export function addMarkdownDocumentation(
|
||||
out.appendMarkdown('\n\n' + tagsPreview);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user