Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript JSON mode #23

Open
stanislavprokopov opened this issue Nov 29, 2023 · 0 comments
Open

JavaScript JSON mode #23

stanislavprokopov opened this issue Nov 29, 2023 · 0 comments

Comments

@stanislavprokopov
Copy link

CodeMirror JavaScript mode supports additional configuration options, allowing to display json, json-ld and typescript (doc)

I need the JSON mode, not sure how this could be configured right now.

CodeMirror supports using mime types as mode values, and then it automatically maps to correct mode, setting application/json is internally replaced with json: true, mode: javascript but setting mime type in the plugin config does not works correctly as it tries to load a js file mode/application/json.js that actually is not there.

This could be fixed by using the same mode resolving logic that CodeMirror has - https://github.com/codemirror/codemirror5/blob/e84384b4210bc35300994de07c6333666f2a5c9e/src/modes.js#L20C1-L20C1 and https://github.com/codemirror/codemirror5/blob/e84384b4210bc35300994de07c6333666f2a5c9e/mode/javascript/javascript.js#L953

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

No branches or pull requests

1 participant