-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add support for Svelte. #4323
Add support for Svelte. #4323
Conversation
912bb6c
to
8ba151c
Compare
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 for submitting the pull request!
Could you please update the template with the required information (the search query for in-the-wild usage, information on added samples, and the link to Lightshow showing the grammar in action)?
@pchaigno Done. |
Svelte creator here, via Twitter. Amazing work Umang, thank you! I noticed that the sample file is using the old Svelte 1 template syntax (e.g. double |
@Rich-Harris Didn't notice the example was written in an older version. I picked up a file from an example on GitHub because the Svelte code that I write for work is confidential. I will pick up an updated sample and update the repository. I can add |
Yeah, usage will be effectively zero for now since we haven't promoted the extension at all (because of the lack of linguist support, which this PR solves!) — we generally just go with good old |
@Rich-Harris Would you agree on keeping |
That makes sense to me, yes |
I'm keeping |
@pchaigno Are there any guidelines on selecting a color for newly added languages? |
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.
I've left a few comments below that should help you address the Travis CI build failures.
Could you also check whether these files are Svelte files too? They looks like plain HTML files to me.
codemirror_mime_type: text/html | ||
color: "#e34c26" | ||
extensions: | ||
- ".svelte" |
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.
I counted 117 repositories by 102 users from the search query you provided. That a bit low considering our usual requirement of hundreds of repositories, but it's unlikely we'll get any conflicts in the future given the extension. @lildude What do you think?
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.
Unfortunately, that usage is not high enough for inclusion right now, it's barely over a hundred let alone hundreds.
@@ -4343,6 +4343,17 @@ STON: | |||
tm_scope: source.smalltalk | |||
ace_mode: text | |||
language_id: 336 | |||
Svelte: | |||
type: markup | |||
tm_scope: text.html.svelte |
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.
This needs to be source.svelte
.
ace_mode: html | ||
codemirror_mode: htmlmixed | ||
codemirror_mime_type: text/html | ||
color: "#e34c26" |
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.
You don't need to set a color since it has a group; it will automatically take the parent's color.
@@ -4343,6 +4343,17 @@ STON: | |||
tm_scope: source.smalltalk | |||
ace_mode: text | |||
language_id: 336 | |||
Svelte: |
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.
Items in languages.yml
should be alphabetically sorted, with uppercase letters first.
They're not Svelte files — my hypothesis is:
Happily, HTML files highlighted as HTMLx will be identical except in some unusual edge cases, so the worst that will result from the false positive is that those files will now be highlighted as HTML instead of not at all. At present, the vast majority of Svelte files are written with an |
Sorry, I missed that before.
Usage is way too low to add them now. Maybe we could add If you think usage of
With this pull request, you'll be able to switch on syntax highlighting of |
Ah, nice, I didn't know about overrides.
That would make it practical to start using that extension, which could hopefully solve the chicken-and-egg problem we have at the moment, so yes — that sounds like an excellent starting point. Could you point us in the right direction please? I expect usage will grow in time, yes — if you could add it to #4219 that'd be great. Thank you! |
If we are going to add support for |
You can follow the contribution guidelines for that.
I wasn't suggesting to add HTMLx as a language, just
Done. |
This pull request has been automatically marked as stale because it has not had recent activity, and will be closed if no further activity occurs. If this pull request was overlooked, forgotten, or should remain open for any other reason, please reply here to call attention to it and remove the stale status. Thank you for your contributions. |
This pull request has been automatically closed because it has not had activity in a long time. Please feel free to reopen it or create a new issue. |
Add support for Svelte.
Checklist:
I am associating a language with a new file extension.
I am adding a new language.
Form.svelte
I am fixing a misclassified language
I am changing the source of a syntax highlighting grammar
I am updating a grammar submodule
I am adding new or changing current functionality