Grafana UI: Update monaco-related dependencies #39027
Merged
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.
the grafana-ui widget
<CodeEditor/>
uses the monaco third-party package internally. i updated the monaco-dependencies to the newest.i need an improvement that is not available in our version of
monaco-editor
(resize-able suggestion-window), so i updated themonaco-editor
package, and i also updated the related@monaco-editor/react
package, because if we risk something breaking in the update, we might as well update the other related package.the changes:
@monaco-editor/react
goes from4.1.1
to4.2.2
. based on the changelog there should be no backward-incompatible changesmonaco-editor
goes from0.21.2
to0.27.0
. basad on the changelog there were several backward-incompatible changes:monaco
object. You can defineglobal.MonacoEnvironment = { globalAPI: true }
if you want for the editor to define this global object.OnTypeRenameProvider
toLinkedEditingRangeProvider
and related methods like the editor optionrenameOnType
(nowlinkedEditing
),registerOnTypeRenameProvider
(nowregisterLinkedEditingRangeProvider
), etc.OnEnterRule.oneLineAboveText
toOnEnterRule.previousLineText
EditorAutoClosingOvertypeStrategy
has been renamed toEditorAutoClosingEditStrategy
inlineHints
toinlayHints
label
,detail
anddescription
(instead ofname
,parameters
,qualifier
andtype
).seedSearchStringFromSelection
from boolean to'never' | 'always' 'selection'
subwordDiff
tosubwordSmart
, introducedsubword
i did a quick check of our source-code and we do not seem to use these attributes whose names have changed (though they do not list all of them in the CHANGELOG 😿 ), and the only place where we access the internal-monaco-object is at https://github.com/grafana/grafana/blob/main/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/LogsQueryEditor/QueryField.tsx#L46-L57 , which seems to be safe, but i was not able to test that part.
unfortunately the monaco-object is part of the
grafana-ui
package API, because some props on the<CodeEditor/>
component use the raw monaco-objects, so this change will have to be marked as backward-incompatible.i quickly tested it with some code-editors, and it seemed to work, but i am not able to test it with every code-editor we have. (and obviously we cannot test the code-editors that third-party plugins have)
Release notice breaking change
The
monaco-editor
dependency ingrafana-ui
has been updated to a newer version (0.27.0
), which is not completely backward compatible with the old version (0.21.2
). The backward incompatible changes are fairly small, but they do exist, so if your code accesses the raw monaco-objects through thegrafana-ui
package, please check the monaco-editor changelog and apply any necessary changes.