Skip to content

Comments

feat(IncludePlugin): regions for tsx#3048

Merged
Gerrit0 merged 3 commits intoTypeStrong:masterfrom
a10nik:patch-1
Dec 13, 2025
Merged

feat(IncludePlugin): regions for tsx#3048
Gerrit0 merged 3 commits intoTypeStrong:masterfrom
a10nik:patch-1

Conversation

@a10nik
Copy link
Contributor

@a10nik a10nik commented Dec 9, 2025

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
Copy link
Contributor Author

a10nik commented Dec 9, 2025

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

@a10nik
Copy link
Contributor Author

a10nik commented Dec 9, 2025

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

@Gerrit0 Gerrit0 merged commit 7d5559a into TypeStrong:master Dec 13, 2025
8 checks passed
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 13, 2025

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...

@a10nik
Copy link
Contributor Author

a10nik commented Dec 17, 2025

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 a10nik deleted the patch-1 branch December 17, 2025 08:24
@a10nik
Copy link
Contributor Author

a10nik commented Dec 17, 2025

Btw when is the next release planned?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 18, 2025

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 Gerrit0 added this to the v0.28.16 milestone Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants