[ES|QL] Auto open suggestions for field lists (#190466)

## Summary

Part of https://github.com/elastic/kibana/issues/189662

## Suggests comma and pipe


https://github.com/user-attachments/assets/c09bc6fd-20a6-4f42-a871-c70e68e6d81a

## Doesn't suggest comma when there are no more fields


https://github.com/user-attachments/assets/29fce13e-e58b-4d93-bce5-6b1f913b4d92

## Doesn't work for escaped columns :(


https://github.com/user-attachments/assets/3d65f3b9-923d-4c0e-9c50-51dd83115c8b

As part of this effort I discovered
https://github.com/elastic/kibana/issues/191100 and
https://github.com/elastic/kibana/issues/191105, as well as a problem
with column name validation (see
https://github.com/elastic/kibana/issues/177699)

I think we can revisit column escaping and probably resolve all of these
issues (issue [here](https://github.com/elastic/kibana/issues/191111)).


### 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
This commit is contained in:
Drew Tate 2024-08-23 11:17:03 -06:00 committed by GitHub
parent bb7466e443
commit 15ef37f2fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 240 additions and 77 deletions

View file

@ -23,6 +23,7 @@ import {
dataTypes,
fieldTypes,
isFieldType,
FunctionParameter,
} from '../src/definitions/types';
import { FUNCTION_DESCRIBE_BLOCK_NAME } from '../src/validation/function_describe_block_name';
import { getMaxMinNumberOfParams } from '../src/validation/helpers';
@ -1155,7 +1156,7 @@ function generateIncorrectlyTypedParameters(
signatures: FunctionDefinition['signatures'],
currentParams: FunctionDefinition['signatures'][number]['params'],
availableFields: Array<{ name: string; type: SupportedDataType }>
) {
): { wrongFieldMapping: FunctionParameter[]; expectedErrors: string[] } {
const literalValues = {
string: `"a"`,
number: '5',
@ -1260,7 +1261,7 @@ function generateIncorrectlyTypedParameters(
})
.filter(nonNullable);
return { wrongFieldMapping, expectedErrors };
return { wrongFieldMapping: wrongFieldMapping as FunctionParameter[], expectedErrors };
}
/**