Adding a temporary theme value to uiSettings for Code Editor usage #158793
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adding a computed theme value to the uiSettings that will be used by Code Editors
The Code Editor fields, found here, are currently relying on
uiSettings > 'theme:darkMode'
to be the source of truth for which theme they should be rendered in.All callers of the Code Editor currently provide
uiSettings
in their context which is then accessed by Code Editor component.After the introduction of Per User Dark Mode, the new source of truth for theme is the Core Theme Service. However, not all plugins currently provide the
theme
service in a consistent way (or even at all). All callers would need to be updated to provide thetheme
to their context in a similar fashion, or, pass the theme down to where the Code Editor component is being called and passed in as a prop (once the value is retrieved from thetheme$
observable).Here is a list of callers for
CodeEditor
:That is a lot of plugins to update/test/review by 8.8.1 FF, I attempted to make the changes, but working on unfamiliar plugins is very challenging and risky. Some of the calls in the list above are wrappers around CodeEditor, which are then called many other places.
The changes in this PR are a 'hack' to take advantage of
uiSettings
already being provided in all necessary contexts, but now providing a correctly computed value (it is the same value that is being provided totheme
).I would like to put this in place temporarily, until either all plugins can make changes to provide
theme
(with more codeowner oversight) or take advantage of future functionality (such as this new context feature)