Currently everything is done in src/syntax_mapping.rs using bespoke code for each syntax mapping we want to add, which is starting to become a problem.
The SyntaxMapping::builtin function is already 160 lines long, and is nowhere near complete. As a daily user of bat, on average I run into this situation several times a week when I'm thinking, "man, this well-known file path really should have syntax mapping built in". But then I remember how it's implemented and think, "I really don't want to make the maintainability any worse than it already is".
What I'm saying is, there has to be a better way to code this to make it more maintainable and extensible (specifically, easier to add more mappings and harder to accidentally add duplicates). So I would like to ask the community for your opinion (how to organise the mappings, what patterns/libraries to use, etc.). I'm happy to help implement the changes if we come to some technical consensus.
Currently everything is done in
src/syntax_mapping.rsusing bespoke code for each syntax mapping we want to add, which is starting to become a problem.The
SyntaxMapping::builtinfunction is already 160 lines long, and is nowhere near complete. As a daily user ofbat, on average I run into this situation several times a week when I'm thinking, "man, this well-known file path really should have syntax mapping built in". But then I remember how it's implemented and think, "I really don't want to make the maintainability any worse than it already is".What I'm saying is, there has to be a better way to code this to make it more maintainable and extensible (specifically, easier to add more mappings and harder to accidentally add duplicates). So I would like to ask the community for your opinion (how to organise the mappings, what patterns/libraries to use, etc.). I'm happy to help implement the changes if we come to some technical consensus.