Skip to content

Add .mill extension to Scala language highlighting - #7028

Open
lihaoyi wants to merge 3 commits into
github-linguist:mainfrom
lihaoyi:patch-1
Open

lihaoyi wants to merge 3 commits into
github-linguist:mainfrom
lihaoyi:patch-1

Conversation

@lihaoyi

@lihaoyi lihaoyi commented Sep 3, 2024 •

Copy link
Copy Markdown

The Mill Scala build tool recently moved its file format extension from .sc to .mill (com-lihaoyi/mill#3426) to better differentiate it from other Scala scripts (Ammonite, Scala-CLI, IntelliJ/VSCode worksheets). This updates Linguist to understand that .mill files should be highlighted as Scala

Description

Checklist:

  • I am adding a new extension to a language.

  • I am adding a new language.

    • The extension of the new language is used in hundreds of repositories on GitHub.com.
    • I have included a real-world usage sample for all extensions added in this PR:
      • Sample source(s):
        • [URL to each sample source, if applicable]
      • Sample license(s):
    • I have included a syntax highlighting grammar: [URL to grammar repo]
    • I have added a color
      • Hex value: #RRGGBB
      • Rationale:
    • I have updated the heuristics to distinguish my language from others using the same extension.
  • I am fixing a misclassified language

    • I have included a new sample for the misclassified language:
      • Sample source(s):
        • [URL to each sample source, if applicable]
      • Sample license(s):
    • I have included a change to the heuristics to distinguish my language from others using the same extension.
  • I am changing the source of a syntax highlighting grammar

    • Old: [URL to grammar repo]
    • New: [URL to grammar repo]
  • I am updating a grammar submodule

  • I am adding new or changing current functionality

    • I have added or updated the tests for the new or changed functionality.
  • I am changing the color associated with a language

    • I have obtained agreement from the wider language community on this color change.
      • [URL to public discussion]
      • [Optional: URL to official branding guidelines for the language]

@lihaoyi
lihaoyi requested a review from a team as a code owner September 3, 2024 15:15

@lildude lildude left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the details for adding an extension in the CONTRIBUTING.md file.

Please also use and fill in the PR template; it's there for a reason.

@lihaoyi

lihaoyi commented Sep 3, 2024

Copy link
Copy Markdown
Author

Got it! Will follow the instructions and report back when we have >200 results in the wild

lihaoyi added a commit to com-lihaoyi/mill that referenced this pull request Sep 4, 2024
Need to make sure everything works and dogfood it a bit before
0.12.0-RC1

This converts Mill over to the `build.mill` file extension. We also
break up `build.mill` into per-folder `package.mill` files:
`scalalib/package.mill`, `main/package.mill`, etc.

IntelliJ users would need go to `Settings` / `Editor` / `File Types` /
`Scala` and add `*.mill`. Github syntax highlighting doesn't work, which
is expected for now until
github-linguist/linguist#7028 lands (which will
need to wait for some usage in the wild according to Github's syntax
highlighting policy)
@lildude lildude added the Pending Popularity Language doesn't need minimum usage requirements. Reassessed when new releases are made. label Jan 8, 2025
@lildude lildude added the Stale Requested changes have not been applied for over 6 months. PR will be closed soon. label Mar 5, 2025
quat1024 added a commit to CrackedPolishedBlackstoneBricksMC/toybox that referenced this pull request Mar 15, 2025
@lihaoyi
lihaoyi requested a review from lildude May 5, 2025 13:40
@lihaoyi

lihaoyi commented May 5, 2025

Copy link
Copy Markdown
Author

Hi! It's been a while since we adopted the new extension, and the The new extension is used in hundreds of repositories on GitHub.com requirements seems to be met now: https://github.com/search?type=code&q=NOT+is%3Afork+path%3Abuild.mill+%22import+mill%22 lists 450 repos using this syntax, and I expect the number to continue to grow over time as people upgrade to the latest version and use the new extension

@lihaoyi

lihaoyi commented May 6, 2025

Copy link
Copy Markdown
Author

I have also completed the checklist, added the search URL in the PR description, and added a sample file together with it's license

@tarmath

This comment was marked as off-topic.

@Quafadas

This comment was marked as off-topic.

@carlosedp

carlosedp commented Jul 22, 2025 •

Copy link
Copy Markdown

Hi, any expected date to get this merged? Which metric is considered when accounting for the "Pending Popularity"?
We have many uses under this case already as seen by doing a query like https://github.com/search?q=path%3Abuild.mill&type=code which reports more than 2.3k matches.

@lildude

lildude commented Jul 22, 2025

Copy link
Copy Markdown
Member

Popularity is only re-assessed whenever a new release is made which is approximately every 3-4 months.

@lildude lildude removed the Stale Requested changes have not been applied for over 6 months. PR will be closed soon. label Sep 15, 2025
@viluon

viluon commented Mar 20, 2026

Copy link
Copy Markdown

@lildude since your comment, v9.3.0, v9.4.0, and now v9.5.0 came out. Has popularity been reassessed?

@lildude

lildude commented Mar 20, 2026

Copy link
Copy Markdown
Member

Has popularity been reassessed?

Yes. It is reassessed with every release and this extension is still a very very long way frmo meeting our usage requirements.

@lefou

lefou commented Mar 23, 2026 •

Copy link
Copy Markdown

Has popularity been reassessed?

Yes. It is reassessed with every release and this extension is still a very very long way frmo meeting our usage requirements.

Would be nice to have some numbers or some transparent metrics. It currently feels arbitrary, although you make it sound it's not. A "very very long way" is the opposite of transparent. If you have usage requirements, please make them public to establish trust.

@lildude

lildude commented Mar 23, 2026

Copy link
Copy Markdown
Member

Would be nice to have some numbers or some transparent metrics. It currently feels arbitrary, although you make it sound it's not. A "very very long way" is the opposite of transparent. If you have usage requirements, please make them public to establish trust.

The usage requirements have been public for a very very long time and have evolved over the years. Things were easy to assess before GitHub's most recent major search update which meant we had to rely on temporary measures detailed in #5756. This issue was pinned to the top of the issues page for about 3 years, and also referenced in the CONTRIBUTING.md file for about 2.5 years, until they were moved and "solidified" into a dedicated section in the CONTRIBUTING.md file earlier this year as we have no better method of assessing popularity.

As this PR is adding an extension that is not expected to only ever appear in a repo once, the 2000 limit is what I use to gauge popularity and I base this on the search query provided in the PR template as I don't have time to do in-depth analysis of usage for each and every PR pending popularity every time I make a release.

@lihaoyi

lihaoyi commented Mar 23, 2026 •

Copy link
Copy Markdown
Author

@lildude CONTRIBUTING.md says:

at least 2000 files per extension or filename indexed in the last year (the number you see at the top of the search results)

When I search for .mill files with the package build string (i.e. files that would match this PR), with search in forks disabled, the number tat the top of the search results now says 3.1k files https://github.com/search?q=%22package+build%22++path%3A*.mill&type=Code&ref=advsearch&l=&l=&p=5

Screenshot 2026-03-23 at 9 25 07 PM

Given that 3.1k > 2000, how is it you are saying that .mill is very very long way frmo meeting our usage requirements.? Am I missing something in how these searches are meant to happen? Seems like we passed the 2000 threshold sometime Q2 2025 (according to @carlosedp's comment reporting 2.3k usages in July 2025) and the number has only gone up since then

@carlosedp

Copy link
Copy Markdown

Exactly, by those metrics this PR could have been merged almost 1 year ago.

@lildude

lildude commented Mar 23, 2026 •

Copy link
Copy Markdown
Member

When I search for .mill files with the package build string (i.e. files that would match this PR), with search in forks disabled, the number tat the top of the search results now says 3.1k files https://github.com/search?q=%22package+build%22++path%3A*.mill&type=Code&ref=advsearch&l=&l=&p=5

[...]

Given that 3.1k > 2000, how is it you are saying that .mill is very very long way frmo meeting our usage requirements.? Am I missing something in how these searches are meant to happen? Seems like we passed the 2000 threshold sometime Q2 2025 (according to @carlosedp's comment reporting 2.3k usages in July 2025) and the number has only gone up since then

Yes. We have deliberately excluded forks for as long as we've had usage requirements (10+ years) as the intention is illustrate wide-spread usage, not widespread copying. Just because a repo gains attention on Hacker News and is then forked X number of times (this happens a lot), doesn't mean it's actually being used. People fork repos all the time without actually using the code or doing anything with the fork. Same with star counts, which we also deliberately don't consider. Both of these are susceptible to gaming and don't provide any real indication of usage, hence we exclude forks.

There is a solution for all users while we wait for the popularity: use an override. The language already exists so you can use an override in the mean time.

@carlosedp

Copy link
Copy Markdown

Yes but on both mine and @lihaoyi searches, forks have been excluded and we get the 3.1k files already which surpasses the previously mentioned 2k threshold.

@lefou

lefou commented Mar 23, 2026

Copy link
Copy Markdown

I get only 1.4k results with path:build.mill OR path:package.mill NOT is:fork

@lefou

lefou commented Mar 23, 2026 •

Copy link
Copy Markdown

I'd like to add, that a build.mill file is typically expected to occur only once per project, much like and even more than the Makefile in the example (as Makefiles typically appear also in sub-dirs more often than not).

Given, that the requirements for such files are at least 200, the mill extension should be included by now. Source:

- at least 200 files per extension or filename indexed in the last year, excluding forks, for extensions or filenames expected to only occur once per repo, like a `Makefile`.

Would be nice to have some numbers or some transparent metrics. It currently feels arbitrary, although you make it sound it's not. A "very very long way" is the opposite of transparent. If you have usage requirements, please make them public to establish trust.

The usage requirements have been public for a very very long time and have evolved over the years. Things were easy to assess before GitHub's most recent major search update which meant we had to rely on temporary measures detailed in #5756. This issue was pinned to the top of the issues page for about 3 years, and also referenced in the CONTRIBUTING.md file for about 2.5 years, until they were moved and "solidified" into a dedicated section in the CONTRIBUTING.md file earlier this year as we have no better method of assessing popularity.

As this PR is adding an extension that is not expected to only ever appear in a repo once, the 2000 limit is what I use to gauge popularity and I base this on the search query provided in the PR template as I don't have time to do in-depth analysis of usage for each and every PR pending popularity every time I make a release.

@lildude Thank you for pointing this out. I missed these number when I scanned over the document.

There may be repos that use the package.mill file more than once, but it's rather a power feature for large projects. But even than, the build.mill file is only expected to be used once (at the project root). Hence, counting just build.mill files and reaching the threshold of > 200 should be fair.

@viluon

viluon commented Mar 23, 2026

Copy link
Copy Markdown

There is a solution for all users while we wait for the popularity: use an override. The language already exists so you can use an override in the mean time.

@lildude thanks, unfortunately overrides via .gitattributes are not enough to highlight PR diffs on GHES, so native support would be preferable.

@lildude

lildude commented Mar 23, 2026

Copy link
Copy Markdown
Member

There is a solution for all users while we wait for the popularity: use an override. The language already exists so you can use an override in the mean time.

@lildude thanks, unfortunately overrides via .gitattributes are not enough to highlight PR diffs on GHES, so native support would be preferable.

That should not be the case. If GHES supports a language it should support the same overrides in the same way as GitHub.com. If you are seeing something different, please report it to GitHub support (it won't be a Linguist issue so I can't do anything about it).

One thing to keep in mind is new Linguist releases are not added to older GHES releases so you would have to update to the newest feature release of GHES to gain this support once merged and the Linguist release made. Linguist releases are made approx every 2-3 months to ensure they get into the next GHES release with the latest being made to ensure it gets into GHES 3.21.0.

@lildude

lildude commented Mar 23, 2026

Copy link
Copy Markdown
Member

That should not be the case. If GHES supports a language it should support the same overrides in the same way as GitHub.com. If you are seeing something different, please report it to GitHub support (it won't be a Linguist issue so I can't do anything about it).

Just tested on GHES 3.20.0 and diffs work a treat with the override:

Screenshot 2026-03-23 at 22 00 45

@viluon

viluon commented Mar 24, 2026 •

Copy link
Copy Markdown

@lildude it works for changes but not for newly added files

image image

on GHES 3.17.11 at least.

@viluon

viluon commented May 5, 2026

Copy link
Copy Markdown

@lildude the above is actually also a problem here on GitHub.com
image

see e.g. here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Pending Popularity Language doesn't need minimum usage requirements. Reassessed when new releases are made.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants