MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / signatureParametersToMarkdownTable

Function signatureParametersToMarkdownTable

packages/lsp/src/server/hover.ts:214–245  ·  view source on GitHub ↗
(signatures: SignatureDefinition[])

Source from the content-addressed store, hash-verified

212}
213
214function signatureParametersToMarkdownTable(signatures: SignatureDefinition[]): string {
215 if (signatures.length === 0 || (signatures.length === 1 && signatures[0].parameters.length === 0)) {
216 return '';
217 }
218
219 const hasOverloads = signatures.length > 1;
220 if (hasOverloads) {
221 return [
222 '',
223 '**Parameters:**',
224 '| Overload | Name | Description | Type | Required |',
225 '|----------|------|-------------|------|----------|',
226 ...signatures.flatMap((s, si) =>
227 s.parameters.map(v => {
228 return `| \`[${si + 1}]\` | \`${v.name}\` | ${(v.longDescription ?? v.shortDescription)?.replaceAll('\n', '<br />') ?? ''} | \`${nodeTypesToSyntax(v).replaceAll('|', '\\|')}\` | ${isRequiredParameter(v.parseMode) ? 'yes' : 'no'} ${v.defaultValue ?? ''} |`;
229 })
230 )
231 ].join('\n');
232 } else {
233 return [
234 '',
235 '**Parameters:**',
236 '| Name | Description | Type | Required |',
237 '|------|-------------|------|----------|',
238 ...signatures.flatMap(s =>
239 s.parameters.map(v => {
240 return `| \`${v.name}\` | ${(v.longDescription ?? v.shortDescription)?.replaceAll('\n', '<br />') ?? ''} | \`${nodeTypesToSyntax(v).replaceAll('|', '\\|')}\` | ${isRequiredParameter(v.parseMode) ? 'yes' : 'no'} ${v.defaultValue ?? ''} |`;
241 })
242 )
243 ].join('\n');
244 }
245}
246
247function parameterValueDocsToMarkDown(docs: ParameterValueDefinition): string {
248 return [`## ${docs.name}`, docs.longDescription ?? docs.shortDescription, ''].join('\n');

Callers 1

withSignaturesToMarkdownFunction · 0.85

Calls 4

isRequiredParameterFunction · 0.85
flatMapMethod · 0.80
joinMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected