[Monaco] Refactor the way XJSON grammar checker gets registered#75160
Merged
jloleysens merged 3 commits intoelastic:masterfrom Aug 18, 2020
Merged
Conversation
- avoid registering multiple model add listeners - remove regsiterGrammarChecker from public API! - fix getWorker handler to register XJSON only for XJSON models
Contributor
|
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
sebelga
approved these changes
Aug 17, 2020
Contributor
sebelga
left a comment
There was a problem hiding this comment.
LGTM! Tested locally and made the 2 editor work.
Type something in the editor, this should be called once only
I have put the breakpoint but it didn't get called when changing the editor value. Even after refreshing the browser window. Maybe we can zoom about that?
| */ | ||
|
|
||
| import { XJsonLang } from '@kbn/monaco'; | ||
| import { XJsonLang, monaco } from '@kbn/monaco'; |
Contributor
There was a problem hiding this comment.
nit: you added the import but don't use it anywhere
Contributor
💚 Build SucceededBuild metricsasync chunks size
History
To update your PR or re-run it, just comment with: |
jloleysens
added a commit
to jloleysens/kibana
that referenced
this pull request
Aug 18, 2020
…tic#75160) * Refactor the way XJSON grammar checker gets registered - avoid registering multiple model add listeners - remove regsiterGrammarChecker from public API! - fix getWorker handler to register XJSON only for XJSON models * remove unused import * updateAnnos -> updateAnnotations
jloleysens
added a commit
to jloleysens/kibana
that referenced
this pull request
Aug 18, 2020
…tic#75160) * Refactor the way XJSON grammar checker gets registered - avoid registering multiple model add listeners - remove regsiterGrammarChecker from public API! - fix getWorker handler to register XJSON only for XJSON models * remove unused import * updateAnnos -> updateAnnotations # Conflicts: # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/field_components/xjson_editor.tsx
jloleysens
added a commit
that referenced
this pull request
Aug 18, 2020
…) (#75288) * Refactor the way XJSON grammar checker gets registered - avoid registering multiple model add listeners - remove regsiterGrammarChecker from public API! - fix getWorker handler to register XJSON only for XJSON models * remove unused import * updateAnnos -> updateAnnotations
gmmorris
added a commit
to gmmorris/kibana
that referenced
this pull request
Aug 18, 2020
* master: Skip failing test in CI (elastic#75266) [Task Manager] time out work when it overruns in poller (elastic#74980) [Drilldowns] misc improvements & fixes (elastic#75276) Small README note on bumping memory for builds (elastic#75247) [Security Solution][Detections] Adds exception modal tests (elastic#74596) [Dashboard] Sample data link does not work (elastic#75262) [Dashboard First] Unlink from Library Action With ReferenceOrValueEmbeddable (elastic#74905) [Form lib] Fix issue where serializer on fields are called on every change (elastic#75166) convert processor labels to sentence case (elastic#75278) [Monaco] Refactor the way XJSON grammar checker gets registered (elastic#75160) Clarify no documents error message when filtering by is_training (elastic#75227) [Lens] Fix crash when two layers xychart switches to pie (elastic#75267) [Observability Homepage] Fix console error because of side effect (elastic#75258) [Usage Collection] Add `legacy=true` option to the /api/stats request in the docs (elastic#75146) [ML] Functional tests - re-activate DFA test suites (elastic#75257) GS providers improvements (elastic#75174) [Visualize] First version of by-value visualize editor (elastic#72256)
jloleysens
added a commit
that referenced
this pull request
Aug 19, 2020
…#75160) (#75291) * [Monaco] Refactor the way XJSON grammar checker gets registered (#75160) * Refactor the way XJSON grammar checker gets registered - avoid registering multiple model add listeners - remove regsiterGrammarChecker from public API! - fix getWorker handler to register XJSON only for XJSON models * remove unused import * updateAnnos -> updateAnnotations # Conflicts: # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/field_components/xjson_editor.tsx * remove use of registerGrammarChecker in XJsonEditor
gmmorris
added a commit
to gmmorris/kibana
that referenced
this pull request
Aug 19, 2020
…emove-header * saved-objects/version-on-create: (59 commits) remove version when loading sample data omit version from SO import/export Skip failing test in CI (elastic#75266) [Task Manager] time out work when it overruns in poller (elastic#74980) [Drilldowns] misc improvements & fixes (elastic#75276) Small README note on bumping memory for builds (elastic#75247) [Security Solution][Detections] Adds exception modal tests (elastic#74596) Revert "Revert "added missing core docs"" Revert "Revert "added version to saved object bulk creation"" [Dashboard] Sample data link does not work (elastic#75262) [Dashboard First] Unlink from Library Action With ReferenceOrValueEmbeddable (elastic#74905) [Form lib] Fix issue where serializer on fields are called on every change (elastic#75166) convert processor labels to sentence case (elastic#75278) [Monaco] Refactor the way XJSON grammar checker gets registered (elastic#75160) Clarify no documents error message when filtering by is_training (elastic#75227) [Lens] Fix crash when two layers xychart switches to pie (elastic#75267) [Observability Homepage] Fix console error because of side effect (elastic#75258) [Usage Collection] Add `legacy=true` option to the /api/stats request in the docs (elastic#75146) [ML] Functional tests - re-activate DFA test suites (elastic#75257) GS providers improvements (elastic#75174) ...
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
This contribution makes the following changes:
regsiterGrammarCheckerfrom public APIThis fixes the workers ability to provide completions for multiple editor instances (two and more) that are using XJSON and it also ensure that we do not double-register a listener (or more times).
How to test
There are not really any instances of the monaco editor being used twice+ simultaneously. I would recommend making the following code changes to test:
x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/custom.tsxwith the code below. This will make the "custom" processor configuration form have 2 editorsXJSON_GRAMMAR_CHECKERin the search box. Select the instance in thelanguage.jsfile. Place a breakpoint inside of theonDidChangeContenthandler (this should be a single call toupdateAnnos. Type something in the editor, this should be called once only, even after opening and closing the flyout.Code