github-linguist / linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
MIT License
12.32k stars 4.27k forks source link

Add Language: Hosts #6389

Closed DandelionSprout closed 1 year ago

DandelionSprout commented 1 year ago

Language name

Hosts, alternately Hosts file.

URL of example repository

https://github.com/StevenBlack/hosts

URL of syntax highlighting grammar

https://marketplace.visualstudio.com/items?itemName=tommasov.hosts

Most popular extensions

A large supermajority seem to use .txt suffixes. Some uncommon cases use no suffixes at all, primarily lists with long history that were meant to overwrite operating systems' /etc/hosts files.

Detected language

Currently none.

Submitter's notes

In relation to the previously approved and implemented "Adblock Filter Syntax" language, I talked a bit with that syntax's main owners at https://github.com/AdguardTeam/VscodeAdblockSyntax/issues/70, who from what I understood recommended to me https://marketplace.visualstudio.com/items?itemName=tommasov.hosts as the recommended method to add colors to Hosts lists/entries.

"Hosts" files' history stretch back to the late 1980's, and have been used for adblocking since the mid-to-late 1990's ("Peter Lowe's List", "Dan Pollock's Hosts"). It is occasionally used to this day by various tools (uBlock Origin, AdGuard Home, Pi-hole, various smaller tools), although it has never been fully implemented in AdGuard Browser Extension or Adblock Plus.

As with "Adblock Filter Syntax", implementation in GitHub Linguist would rely largely on repos' .gitattritubes specifying filetypes and linguist-detectable. I estimate a low-5-digit amount of GitHub repos using Hosts syntax, some with ≥1,000 stars.

Alhadis commented 1 year ago

I forgot I started work on this a while ago (on a branch I never pushed to GitHub). I've remedied that in #6391 (which is still a WIP at this stage, although input's nonetheless welcome).