[Bug] TypeScript JSDoc tags: missing space after `@param`, stray spaces around `{@link}`, `- ` separator kept

Open
#5,513 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@hediet is already working on this.

Since Oct 7, 2026.

Assessment

This issue has not been assessed yet.

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.57.0#XQAAAAJnAgAAAAAAAABBqIlHNxBUiEDLq8tVgmqdRUkJtSH_-N_19wb9lnmg8HLctA4TJ_57Q9uixI2SKZHqBHaoearIszRMRd2-VrGdHUALnJaHLq2ZsLSp4LnDh6RPnGZctAv_IIxDld3L5z87UyJLWcKJ8yJ-5KmhX1Q9fLnGnxF_wSAwzRxd3UnPDW6blXC7xrBKLLcrOpL8AdSFiNu8QxUZ5HzCDJ-Dgy0yviQGirGAlGy_-qo9I2VO2M98-rLLAXd239U4EGkUAqFABTQJojlW_B_VbphFXwolFgGrfYmHwJ-jXFxRaTAd__9ALUzaJ4zRoKwGeOrSEjjdWe3tbZ5o_c9JtG11Ts8j_LdKTowJTS051hKiuYcVJguLibN9CuuxcBSCPA1QbIrxuBJCuyIdoMHFwtg2GQf42FpxVJyXcApEscOaLD4GeauFDBAc5pnGaPjExWHkJG2LOgO2qhl1bXalJKLfJ7Vtn7SgfLRQ6_dbUB8Nop-7DdqhVDvEkoyxm6UTIBiOK07ofE5nefmCJGUrSK59VZO1GDc1T_YY_ZSIA_S2JhrJSAMLB3mx7dGOlyX-sDDY

Monaco Editor Playground Code
const value = `/**
 * Formats a duration.
 *
 * @param ms - The duration in milliseconds.
 * @param unit The unit to format in. See {@link Intl.NumberFormat}.
 * @returns The formatted duration.
 */
function format(ms, unit) {}

format(1500, "s");
`;

const editor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "javascript",
});

// hover `format` on the last line
editor.setPosition({ lineNumber: 10, column: 2 });
editor.focus();
setTimeout(() => editor.trigger("repro", "editor.action.showHover", {}), 1000);
Reproduction Steps

Run the preview; the hover for format opens.

Actual (Problematic) Behavior

The hover's tag markdown, from TypeScript 5.9.3's tags:

*@param*`ms` —   - The duration in milliseconds.

*@param*`unit` —   The unit to format in. See  {@link  Intl.NumberFormat } .

*@returns* — The formatted duration.

There's no space after @param, the {@link} parts are joined with spaces, and the - after ms is kept.

Expected Behavior

The spacing and separators VS Code uses (getTagDocumentation in extensions/typescript-language-features/src/languageFeatures/util/textRendering.ts):

*@param* `ms` — The duration in milliseconds.

*@param* `unit` — The unit to format in. See {@link Intl.NumberFormat}.

*@returns* — The formatted duration.

(VS Code also renders {@link} as a link, which monaco doesn't support: #4821.)

Additional Context

The tags are formatted by tagToString. VS Code's getTagDocumentation joins a tag's parts with '', puts a space after the tag name, and drops the - after a parameter name. It also puts multi-line tag text, such as an @example code block, on its own line, which would fix #3107 and #5167 as well (#5350 handles only text that starts with a code fence).

I propose porting those rules to tagToString; I can open a PR for it.

Dominant language
JavaScript
Stars
47k
Forks
4.2k
Avg merge
3d 13h
Merged PRs (30d)
13

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/monaco-editor

All issues in microsoft/monaco-editor

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.