Move all configuration value validity checks into one place
Currently, functions like getAiAssistedCodeSuggestionsConfiguration get configuration values without validating them. That means, despite what the type system says about them, they may have the wrong shape.
Rather than passing around these technically unknown values and checking their shape in various places, getAiAssistedCodeSuggestionsConfiguration (and similar) should return validated data structures.
One possibility would be to implement something like a ValidatedWorkspaceConfiguration class that receives a mapping of configuration leaf nodes to type predicates. It could have a getValueOrDefault method that, given a leaf configuration identifier string, would:
- Get the raw configuration value
- Check it with the type predicate
- If true, return value
- If false, get the configuration default
- Check it with the type predicate
- If true, return default
- Throw error
Tasks
-
Make getAiAssistedCodeSuggestionsConfigurationreturn only valid data structures -
Rename parseLanguageConfigurationtoparseDisabledSupportedLanguagesand simplify -
Remove all other checks against enabledSupportedLanguagesandadditionalLanguages(and similar?)
Edited by Mark Florian