Don't add empty filter sets to the file filter dropdown list.#7975
Don't add empty filter sets to the file filter dropdown list.#7975
Conversation
|
@RaymondLim Will a validator for the file filters preference help with this issues? |
|
Not sure a validator may help since current filters preference is an object and not a simple primitive type or just an array. And I think creating a validator may need more code than what we have right now and may not really simplify the code. |
There was a problem hiding this comment.
@RaymondLim
Instead of just dropping patterns that aren't defined in the Preferences file as an array, could we allow them by just returning the single pattern?
For example, instead of returning an empty string here, could we just return filter; in the line above? That would allow a user to specify a single pattern (ie. without the array notation) in the Preferences file like this:
"fileFilters": [ { "name": "JS files", "patterns": "*.js" } ]
There was a problem hiding this comment.
@bchintx I think we should enforce the consistency of our preferences format and data type. Otherwise, we may end up with complicated code that handles multiple data types. For example, how about multiple filter strings without the []? I know that multiple strings will break the JSON file, but it's possible that someone may mistakenly create a filter set with no enclosing brackets. So instead of handling one extra case, I'd rather enforce the correct data format and data type.
|
@RaymondLim Done w/ review. Looks great, and I've verified the change fixes both #7973 and #7974. I've just one request in-line above. |
|
Changes look good. Merging... |
Don't add empty filter sets to the file filter dropdown list.
This fixes #7973 and #7974.