diff --git a/packages/kbn-monaco/scripts/utils/create_autocomplete_definitions.js b/packages/kbn-monaco/scripts/utils/create_autocomplete_definitions.js index d6eeac2e20f61..3750b8697f493 100644 --- a/packages/kbn-monaco/scripts/utils/create_autocomplete_definitions.js +++ b/packages/kbn-monaco/scripts/utils/create_autocomplete_definitions.js @@ -36,7 +36,7 @@ const getDisplayName = (name, imported) => { displayName = name.split('.').pop() || name; } - return displayName.replace('$', '.'); + return displayName.replace(/^\$/g, '.'); }; /** diff --git a/packages/kbn-monaco/src/painless/worker/painless_worker.ts b/packages/kbn-monaco/src/painless/worker/painless_worker.ts index 332199f45b8ee..80489ccdbc589 100644 --- a/packages/kbn-monaco/src/painless/worker/painless_worker.ts +++ b/packages/kbn-monaco/src/painless/worker/painless_worker.ts @@ -44,7 +44,7 @@ export class PainlessWorker implements BaseWorkerDefinition { fields?: PainlessAutocompleteField[] ): PainlessCompletionResult { // Array of the active line words, e.g., [boolean, isTrue, =, true] - const words = currentLineChars.replace('\t', '').split(' '); + const words = currentLineChars.replace(/\t/g, '').split(/\s/); const autocompleteSuggestions: PainlessCompletionResult = getAutocompleteSuggestions( context,