-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Monaco] Refactor the way XJSON grammar checker gets registered #75160
[Monaco] Refactor the way XJSON grammar checker gets registered #75160
Conversation
- avoid registering multiple model add listeners - remove regsiterGrammarChecker from public API! - fix getWorker handler to register XJSON only for XJSON models
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
@@ -3,8 +3,7 @@ | |||
* or more contributor license agreements. Licensed under the Elastic License; | |||
* you may not use this file except in compliance with the Elastic License. | |||
*/ | |||
|
|||
import { XJsonLang } from '@kbn/monaco'; | |||
import { XJsonLang, monaco } from '@kbn/monaco'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you added the import but don't use it anywhere
💚 Build SucceededBuild metricsasync chunks size
History
To update your PR or re-run it, just comment with: |
…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
…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
…) (#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
* 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)
…#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
…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) ...
Summary
This contribution makes the following changes:
regsiterGrammarChecker
from 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.tsx
with the code below. This will make the "custom" processor configuration form have 2 editorsXJSON_GRAMMAR_CHECKER
in the search box. Select the instance in thelanguage.js
file. Place a breakpoint inside of theonDidChangeContent
handler (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