Skip to content

Commit

Permalink
Add the ability for the ScopeResolver to escape the "."
Browse files Browse the repository at this point in the history
The "." means that we want to go a level deeper for the location
of the relative autocomplete, something like ".a.b", but in
a lot of cases "." is actually part of the internal endpoint
name and so we need to respect that to resolve correctly.
  • Loading branch information
jloleysens committed Apr 9, 2020
1 parent abe3ccf commit 279410d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/plugins/console/public/lib/autocomplete/body_completer.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,18 @@ class ScopeResolver extends SharedComponent {
throw new Error('unsupported link format', this.link);
}

let path = this.link.replace(/\./g, '{').split(/(\{)/);
let path = this.link
.replace(/[\\]?\./g, match => {
// An escaped '.' is collapsed to '.';
if (match.startsWith('\\')) {
return '.';
}
// If there is no leading '\' then replace the '.' with the noop '{' char
// for us to split this path on.
return '{';
})
.split(/(\{)/);

const endpoint = path[0];
let components;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
}
},
"transient": {
"__scope_link": ".persistent"
"__scope_link": "cluster\\.put_settings.persistent"
}
}
}
Expand Down

0 comments on commit 279410d

Please sign in to comment.