-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
Source filenames from linguist language.yml
#931
Comments
Sorry, I have no idea what this issue is asking for? |
Are you suggesting using it for file extension detection, or something else? I think the issue is that the mapping from Linguist file types to Chroma file types won't be 1:1 |
Take for example the chroma/lexers/embedded/json.xml Lines 5 to 6 in e9292e6
Linguist knows 17 extensions and 15 filenames: This rich data from the linguist file could for example be extracted from the linguist file and written into chroma lexer's Yes, it won't be a 1:1 mapping but the data extraction could be made best-effort where we map linguist name to chroma lexer name. |
Not sure how you would feel about an additional dependency, but there is also https://github.com/go-enry/go-enry which offers various ways to detect a language based on filename or content (think bash scripts with no file extension). As far as I know, it is based on a somewhat-regularily updated dataset sourced from linguist. All that's left to do for chroma would be to map the detected language to a lexer. |
Is there an existing issue for this?
What problem does this feature solve?
Chroma's language metadata is somewhat lacking.
What feature do you propose?
Linguist's languages.yml is probably the most up to date data on programming languages filenames on the internet.
I think one solution could be to embed either the whole file or just the relevant parts of it into the module via
go:embed
during a build process and then use it as the single authorative source for chroma's lexer-from-filename detection.The text was updated successfully, but these errors were encountered: