-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Restore syntax highlighting for mimetypes with more than one identifier #15175
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
Conversation
|
Thanks for making a pull request to jupyterlab! |
|
Thanks for submitting your first pull request! You are awesome! 🤗 |
fcollonval
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jans-code
I have a minor improvement but otherwise the logic is good.
| if (spec.mime.length == 0) { | ||
| widget.content.model.mimeType = 'text/plain'; | ||
| } else { | ||
| widget.content.model.mimeType = spec.mime[0] as string; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can be more condense for the fallback. And there is a variable to avoid hard coding text/plain.
| if (spec.mime.length == 0) { | |
| widget.content.model.mimeType = 'text/plain'; | |
| } else { | |
| widget.content.model.mimeType = spec.mime[0] as string; | |
| } | |
| widget.content.model.mimeType = spec.mime[0] as string ?? IEditorMimeTypeService.defaultMimeType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much nicer indeed!
krassowski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @jans-code!
fcollonval
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jans-code
|
@meeseeksdev please backport to 4.0.x |
…es with more than one identifier
…re than one identifier (#15205) Co-authored-by: Jan Arman Parpin <112409139+jans-code@users.noreply.github.com>


References
Fixes #15172
Code changes
Checking if 'spec.mime' is an array, and if it is using the first string for 'widget.content.model.mimeType', else business as usual.
User-facing changes
n/a
Backwards-incompatible changes
n/a
Edit to link the issue.