eclipse-theia/theia
View on GitHubLazily Create Monaco Models in Resource Preference Providers
Open
#7,426 opened on Mar 26, 2020
enhancementhelp wantedmonacopreferences
Description
For a while now, AbstractResourcePreferenceProvider has used monaco editor models to manage the contents of settings files. This creates a circular dependency, because the editor model waits for preferences to be ready and preferences can't be read before the editor model is created. While this seems to work, I think it would be better if we would apply the following changes:
- Read the file contents directly from the file initially. Only signal "ready" once the file contents have been read
- Create a monaco model on demand, that is when opening an editor or when setting a preference programatically. Once we have the model, we can keep it just like now.
Opening an editor will create a model, which will wait for preferences to be ready. I also would setting a preference before the preferences provider is ready to be a programming error to be rejected.