Skip to content

@includeCode does not allow regions in typescript files with .mts file extension #2935

@littlespex

Description

@littlespex
Contributor

Search terms

@includecode, mts

Expected Behavior

@includeCode works with all valid Typescript file extensions

Actual Behavior

An error is produced:

[error] @includeCode tag in {FUNCTION} specified "{FILE}.mts#{REGION}", but regions are not supported for this file extension.

Steps to reproduce the bug

  1. Create a typescript file with the .mts extension.
  2. Add a //#region comment block to the .mts file
  3. Reference the region form another file using a {@includeCode} tag

Reproduction PR: TypeStrong/typedoc-repros#52

Environment

  • Typedoc version: 0.28.2
  • TypeScript version: 5.8.3
  • Node.js version: 23.9.0
  • OS: macOs 15.3.2

Activity

added theissue type on Apr 15, 2025
added a commit that references this issue on Apr 15, 2025
littlespex

littlespex commented on Apr 15, 2025

@littlespex
ContributorAuthor

I tried adding regionTagREsByExt["mts"] = regionTagREsByExt["ts"];. It solves the issue, but now I see this warning:

[warning] Unsupported highlight language mts will not be highlighted in comment
Gerrit0

Gerrit0 commented on Apr 15, 2025

@Gerrit0
Collaborator

Ah, that makes some sense, we'll probably have to add some default aliases in https://github.com/TypeStrong/typedoc/blob/master/src/lib/utils/highlighter.tsx

added a commit that references this issue on Apr 15, 2025
littlespex

littlespex commented on Apr 15, 2025

@littlespex
ContributorAuthor

Thanks! I'll have a PR shortly

changed the title [-]@includeCode does to allow regions in typescript files with .mts file extension[/-] [+]@includeCode does not allow regions in typescript files with .mts file extension[/+] on Apr 15, 2025
added this to the v0.28.3 milestone on Apr 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueEasier issue for first time contributors

    Type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @littlespex@Gerrit0

      Issue actions

        @includeCode does not allow regions in typescript files with .mts file extension · Issue #2935 · TypeStrong/typedoc