Nixinova / LinguistJS

Analyse and list all languages used in a folder. Implementation of and powered by GitHub's Linguist.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parent languages are ignored

Nixinova opened this issue · comments

Fixing #5 made me realise linguist-js ignores parent languages when classifying.

Running linguist on tsx & jsx files returns 'TSX, JavaScript' as the results, which may or may not be wanted.

"results": {
  "JavaScript": { "type": "programming", "bytes": 63, "color": "#f1e05a" },
  "TSX": { "type": "programming", "bytes": 86, "color": "#2b7489" }
}

There should be a parent/group parameter for each language in languages.results[lang], I think, and a boolean option to control whether parenthood is followed up on may also be useful.

Linguist will display the parent languages by default, which may be an abrupt change but github-linguist typically uses sub-languages just to offer different syntax highlighting for different file extensions, so using sub-languages by default will lead to inconsistencies.