mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 19:42:56 +01:00
Include tags in documentation string of suggestion items
This commit is contained in:
parent
a258f3a296
commit
5f2d3f73ab
1 changed files with 20 additions and 1 deletions
|
|
@ -508,7 +508,7 @@ export class SuggestAdapter
|
|||
kind: SuggestAdapter.convertKind(details.kind),
|
||||
detail: displayPartsToString(details.displayParts),
|
||||
documentation: {
|
||||
value: displayPartsToString(details.documentation)
|
||||
value: SuggestAdapter.createDocumentationString(details)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -545,6 +545,25 @@ export class SuggestAdapter
|
|||
|
||||
return languages.CompletionItemKind.Property;
|
||||
}
|
||||
|
||||
private static createDocumentationString(
|
||||
details: ts.CompletionEntryDetails
|
||||
): string {
|
||||
let documentationString = displayPartsToString(details.documentation);
|
||||
if (details.tags) {
|
||||
for (const tag of details.tags) {
|
||||
documentationString += `\n\n*@${tag.name}*`;
|
||||
if (tag.name === 'param' && tag.text) {
|
||||
const [paramName, ...rest] = tag.text.split(' ');
|
||||
documentationString += `\`${paramName}\``;
|
||||
if (rest.length > 0) documentationString += ` — ${rest.join(' ')}`;
|
||||
} else if (tag.text) {
|
||||
documentationString += ` — ${tag.text}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
return documentationString;
|
||||
}
|
||||
}
|
||||
|
||||
export class SignatureHelpAdapter
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue