eclipse-theia/theia

Lazily Create Monaco Models in Resource Preference Providers

Open

#7,426 创建于 2020年3月26日

在 GitHub 查看
 (4 评论) (0 反应) (0 负责人)TypeScript (2,478 fork)batch import
enhancementhelp wantedmonacopreferences

仓库指标

Star
 (18,676 star)
PR 合并指标
 (平均合并 15天 4小时) (30 天内合并 75 个 PR)

描述

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:

  1. Read the file contents directly from the file initially. Only signal "ready" once the file contents have been read
  2. 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.

贡献者指南