Skip to content

Need a more sustainable way to manage known syntax mappings #2747

@cyqsimon

Description

@cyqsimon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions