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

Add gjs/gts highlighting to GitHub #123

Closed
NullVoxPopuli opened this issue Feb 2, 2023 · 12 comments
Closed

Add gjs/gts highlighting to GitHub #123

NullVoxPopuli opened this issue Feb 2, 2023 · 12 comments

Comments

@NullVoxPopuli
Copy link
Collaborator

NullVoxPopuli commented Feb 2, 2023

We need 200 unique repos before they'll accept a PR:

https://github.com/github/linguist/blob/master/CONTRIBUTING.md#adding-an-extension-to-a-language
https://github.com/github/linguist/blob/master/CONTRIBUTING.md#adding-a-language

Here is a search for all the gjs/gts files currently on GitHub.
at this time, I don't know how to count repos from these results -- the repos mentioned on the right-hand side of the page feel very incomplete.

@wagenet
Copy link
Contributor

wagenet commented Feb 2, 2023

Do private repos count? Also, could I just open 200 repos each with one .gts file? :D

@dfreeman
Copy link
Collaborator

dfreeman commented Feb 3, 2023

For what it's worth, I've been using this search which returns a few more hits, all of which are legitimate as far as I can tell.

It looks like Code Search will only give you the first 100 results, though, so I wonder if the repo list there is just the repositories that contain those hits?

Do private repos count?

I've hunted for an answer to that question in the past and haven't been able to find one. Might be worth asking somewhere?

@gitKrystan
Copy link

Per the github-linguist documentation, the rule for adding a new extension is usually the following:

We try only to add new extensions once they have some usage on GitHub. In most cases we prefer that each new file extension be in use in at least 200 unique :user/:repo repositories before supporting them in Linguist.

-- CONTRIBUTING.md

But, the way they were using to determine "200 unique :user/:repo repositories" is in flux with the new GitHub code search feature, so they are temporarily using the following rules as a proxy of determining the above:

  • at least 2000 files per extension indexed in the last year (the number you see at the top of the search results), unless the extension is expected to only occur once per repo, then 200 files.
  • with a reasonable distribution across unique :user/:repo combinations assessed by manually and randomly clicking through the results.

-- github-linguist/linguist#5756

Using a quick search, it looks like there are currently over 900 gjs/gts files on GitHub: search: "(path:.gjs OR path:.gts) AND (content:@ember OR content:@glimmer OR content:<template>) "

(Notably, there is already support for another .gts extension--Gerber file--but we should be able to disambiguate, as I've done in the search above and following these docs. @wycats noted that Gerber files seem to always start with "G0X" and have lines starting with "%".)

In the meantime, @wagenet noted a way to use the documented override strategies to get at least the JS/TS portion of a gts/gjs file highlighted. Just add the following to a .gitattributes file in the top level of the repository:

*.gjs linguist-language=js linguist-detectable
*.gts linguist-language=ts linguist-detectable

Example:
image

@NullVoxPopuli
Copy link
Collaborator Author

NullVoxPopuli commented Jul 27, 2023

I think we should include markdown codefences in our search, via this:

https://github.com/search?q=%28%28path%3A*.gjs+OR+path%3A*.gts%29+AND+%28content%3A%3Ctemplate%3E%29%29+OR+%28path%3A*.md+AND+content%3A%3Ctemplate%3E+AND+content%3Agjs%29%29&type=code

This puts us at 1.8k files, which is ~ 200 short of the required 2000.
(this includes vue... so.. 🙃 )

If I try to exclude mentions of vue, that puts us back down at 1200 for now: https://github.com/search?q=%28%28path%3A*.gjs+OR+path%3A*.gts%29+AND+%28content%3A%3Ctemplate%3E%29%29+OR+%28path%3A*.md+AND+content%3A%3Ctemplate%3E+AND+content%3Agjs+AND+%28NOT+content%3Avue%29%29%29&type=code

I have more gjs/gts tests to write.

@gilest
Copy link

gilest commented Sep 22, 2023

Draft PR for adding gts/gjs highlighting support to GitHub. Getting feedback here before I target the upstream Lingust repo gilest/linguist#1

@gilest
Copy link

gilest commented Sep 22, 2023

PR opened github-linguist/linguist/pull/6556

@jakebixby
Copy link

jakebixby commented Oct 5, 2023

I think we should include markdown codefences in our search, via this:

github.com/search?q=%28%28path%3A*.gjs+OR+path%3A*.gts%29+AND+%28content%3A%3Ctemplate%3E%29%29+OR+%28path%3A*.md+AND+content%3A%3Ctemplate%3E+AND+content%3Agjs%29%29&type=code

This puts us at 1.8k files, which is ~ 200 short of the required 2000. (this includes vue... so.. 🙃 )

If I try to exclude mentions of vue, that puts us back down at 1200 for now: github.com/search?q=%28%28path%3A*.gjs+OR+path%3A*.gts%29+AND+%28content%3A%3Ctemplate%3E%29%29+OR+%28path%3A*.md+AND+content%3A%3Ctemplate%3E+AND+content%3Agjs+AND+%28NOT+content%3Avue%29%29%29&type=code

I have more gjs/gts tests to write.

It's odd that adding the markdown bit to the query reduces the count, whereas without (see below) I see 2.3k files, which I would assume meets the threshold? https://github.com/search?q=((path:*.gjs+OR+path:*.gts)+AND+(content:%3Ctemplate%3E))&type=code

EDIT
Oh, I see they are asking for the counts to be per file extension, which is currently only 1.5k for gjs
https://github.com/search?q=((path:*.gjs)+AND+(content:%3Ctemplate%3E))&type=code

and 1k for gts
https://github.com/search?q=((path:*.gts)+AND+(content:%3Ctemplate%3E))&type=code

I wonder if it would be worth asking engineers at some of the companies using ember to create individual repos with gjs and gts files? If forking counts, it could be relatively quick to build up 200 repos. Maybe we could achieve by forking a tutorial app and doing workshops to introduce folks to the basics?

@NullVoxPopuli
Copy link
Collaborator Author

@fdeters
Copy link

fdeters commented Jan 5, 2024

Just saw that Glimmer JS is supported as of github-linguist v7.28.0 🎉

Syntax highlighting is working in my repos, but looks like we're still waiting to see Glimmer JS in the language breakdown chart.

@deanylev
Copy link

@fdeters seems to only be for .gjs files, not .gts files 😕

@NullVoxPopuli
Copy link
Collaborator Author

Gts is soon, we've just crossed the threshold for what was needed to allow us to submit a pr

@NullVoxPopuli
Copy link
Collaborator Author

This is done!

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

8 participants