I’m building a plugin which has a list of patterns it tries to match. It loops over the patterns in order and uses the first one that matched.
I want to make the list configurable, so users can add or remove items from the list depending on their needs, maybe even per filetype.
However, the order of the list is important because some patterns are contained in others. I tried using a dictionary but it seems to reorder the elements when iterating over them.
What would be the best way to allow configuration of that list, while avoiding users having to change their config too much when additions are made to the default list?