Skip to content

Commit

Permalink
Fix autocomplete on only 1 letter typed in request editor (#164707)
Browse files Browse the repository at this point in the history
## Summary

This PR fixes autocomplete on only 1 letter typed in request editor.

Closes #164542

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

## Release note

Fixes autocomplete on only 1 letter typed in Console's request editor
  • Loading branch information
sakurai-youhei authored Sep 1, 2023
1 parent d117fae commit eaee02f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 1 addition & 5 deletions src/plugins/console/public/lib/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1077,11 +1077,7 @@ export default function ({
tracer('has started evaluating current token', currentToken);

if (!currentToken) {
if (pos.lineNumber === 1) {
lastEvaluatedToken = null;
tracer('not starting autocomplete due to invalid current token at line 1');
return;
}
lastEvaluatedToken = null;
currentToken = { position: { column: 0, lineNumber: 0 }, value: '', type: '' }; // empty row
}

Expand Down
2 changes: 0 additions & 2 deletions test/functional/apps/console/_autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe.skip('anti-regression watchdogs', () => {
beforeEach(async () => {
await PageObjects.console.clearTextArea();
await PageObjects.console.pressEnter();
});

it('should suppress auto-complete on arrow keys', async () => {
Expand Down Expand Up @@ -92,7 +91,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

for (const method of methods) {
await PageObjects.console.clearTextArea();
await PageObjects.console.pressEnter();

for (const char of method.slice(0, -1)) {
await PageObjects.console.sleepForDebouncePeriod();
Expand Down

0 comments on commit eaee02f

Please sign in to comment.