Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grafana UI: Update monaco-related dependencies #39027

Merged
merged 1 commit into from
Sep 10, 2021
Merged

Grafana UI: Update monaco-related dependencies #39027

merged 1 commit into from
Sep 10, 2021

Conversation

gabor
Copy link
Contributor

@gabor gabor commented Sep 9, 2021

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 the monaco-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:

  • the package @monaco-editor/react goes from 4.1.1 to 4.2.2. based on the changelog there should be no backward-incompatible changes
  • the package monaco-editor goes from 0.21.2 to 0.27.0. basad on the changelog there were several backward-incompatible changes:
    • The ESM version of the editor will no longer define a global monaco object. You can define global.MonacoEnvironment = { globalAPI: true } if you want for the editor to define this global object.
    • Renamed OnTypeRenameProvider to LinkedEditingRangeProvider and related methods like the editor option renameOnType (now linkedEditing), registerOnTypeRenameProvider (now registerLinkedEditingRangeProvider), etc.
    • Renamed OnEnterRule.oneLineAboveText to OnEnterRule.previousLineText
    • EditorAutoClosingOvertypeStrategy has been renamed to EditorAutoClosingEditStrategy
    • renamed inlineHints to inlayHints
    • CompletionItemLabel now has the property label, detail and description (instead of name, parameters, qualifier and type).
    • changed seedSearchStringFromSelection from boolean to 'never' | 'always' 'selection'
    • changed suggestion preview mode subwordDiff to subwordSmart, introduced subword

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 in grafana-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 the grafana-ui package, please check the monaco-editor changelog and apply any necessary changes.

@gabor gabor requested review from a team, oscarkilhed and dprokop and removed request for a team and oscarkilhed September 9, 2021 09:56
@gabor gabor marked this pull request as draft September 9, 2021 10:57
@gabor
Copy link
Contributor Author

gabor commented Sep 9, 2021

i've decided to not do the update at this point, so closing the pull request.

@gabor gabor closed this Sep 9, 2021
@gabor gabor reopened this Sep 9, 2021
@gabor
Copy link
Contributor Author

gabor commented Sep 9, 2021

seems we are doing this, so reopening.

@gabor gabor requested review from joshhunt, a team, mckn, thisisobate and dprokop and removed request for a team September 9, 2021 16:03
@gabor gabor added this to the 8.2.0 milestone Sep 9, 2021
@gabor gabor changed the title grafana-ui: monaco dependencies updated grafana-ui: update monaco-related dependencies Sep 9, 2021
@gabor gabor changed the title grafana-ui: update monaco-related dependencies Grafana UI: update monaco-related dependencies Sep 9, 2021
@gabor gabor marked this pull request as ready for review September 9, 2021 16:14
Copy link
Member

@ryantxu ryantxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the options in their changelog are pretty essoteric -- I think we can safely update, and would even downplay the "breaking" part on the changelog

@gabor gabor merged commit 580b03c into main Sep 10, 2021
@gabor gabor deleted the gabor/new-monaco branch September 10, 2021 08:36
@achatterjee-grafana achatterjee-grafana changed the title Grafana UI: update monaco-related dependencies Grafana UI: Update monaco-related dependencies Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants