typedoc icon indicating copy to clipboard operation
typedoc copied to clipboard

feat(IncludePlugin): regions for tsx

Open a10nik opened this issue 2 months ago • 2 comments

Apparently including regions from TSX like {@includeCode ./examples.tsx#component} was not supported:

[error] @includeCode tag in MyComponent specified "./examples.tsx#component", but regions are not supported for this file extension.

a10nik avatar Dec 09 '25 09:12 a10nik

Added jsx, mjs and cjs extensions as well while I'm at it

a10nik avatar Dec 09 '25 09:12 a10nik

Tested a bit if vscode supports other region syntaxes inside JSX tags themselves, to see if we should add more regexes for JSX-like extensions. Looks like it doesn't. image

Noticed another discrepance between vscode and IncludePlugin: IncludePlugin requires the closing comment to also have a regionName while it seems to be ignored in vscode:

image This one is foldable no matter what the closing text is image

a10nik avatar Dec 09 '25 10:12 a10nik

Thanks!

The end region text discrepancy is unfortunate... I didn't implement the original feature, but I suspect the intent was to handle nested regions...

Gerrit0 avatar Dec 13 '25 17:12 Gerrit0

Actually, nested regions should work fine either way -- it's like bracket sequences. One doesn't need to tell each closing bracket which of the opening ones it refers to.

//#region a
//#region b

//#endregion (no way it can refer to region a, since b should close first)

I can only see its usefullness if we wanted to support partially overlapping regions like

//#region a
//#region b
//#endregion a
//#endregion b

However, I don't think it's important enough to open an issue about.

a10nik avatar Dec 17 '25 08:12 a10nik

Btw when is the next release planned?

a10nik avatar Dec 17 '25 08:12 a10nik

Unfortunately it'll likely be January; I've been very busy. NPM's decision to break literally everyone's CI automation arbitrarily and ignore everyone complaining is something I need to deal with fixing to get releases working again, and it isn't quite just a trivial fix without breaking beta/lts publishing. (Recurring 90 day breakage isn't something I have the patience to deal with, it needs to be fixed exactly once)

If you need features on master you should be able to install via a Git dependency.

Gerrit0 avatar Dec 18 '25 06:12 Gerrit0