Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

URLForMode callback along with modeURL #6294

Closed

Description

@tolmasky

I have my modes compiled with shasums attached that way I can serve them as immutbale resources (so for example /javascript/javascript-sha256-23958394893040blahblah). This makes the current replacement-based modeURL system difficult to use for dynamically loading modes. I actually currently get away with passing in a fake string object that has a replace method:

CodeMirror.modeURL = { replace: (_, mode) => lookupComplexURLForMode(mode) };

While this works today, it is certainly not ideal as I have to rely on knowledge that replace() gets called. Having modeURL accept a function, or a separate URLForMode option for a callback that returns the URL given a mode would make my code more future-proof.

Activity

  1. marijnh commented on Jun 3, 2020

    @marijnh
    Member

    Does the path option from attached patch help?

  2. tolmasky commented on Jun 3, 2020

    @tolmasky
    Author

    Responding here too -- yes this looks good! Thanks!

  3. marijnh commented on Jun 3, 2020

    @marijnh
    Member

    Great!

  4. added a commit that references this issue on Oct 31, 2020
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions