kibana/packages/kbn-esql-validation-autocomplete/index.ts
Drew Tate 15ef37f2fd
[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
2024-08-23 12:17:03 -05:00

77 lines
2.2 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export type { SuggestionRawDefinition, ItemKind } from './src/autocomplete/types';
export type { CodeAction } from './src/code_actions/types';
export type {
FunctionDefinition,
CommandDefinition,
CommandOptionsDefinition,
CommandModeDefinition,
Literals,
} from './src/definitions/types';
export type { ESQLCallbacks } from './src/shared/types';
/**
* High level functions
*/
// Given an the query string, its AST and the cursor position, it returns the node and some context information
export { getAstContext } from './src/shared/context';
// Validation function
export { validateQuery } from './src/validation/validation';
// Autocomplete function
export { suggest } from './src/autocomplete/autocomplete';
// Quick fixes function
export { getActions } from './src/code_actions/actions';
/**
* Some utility functions that can be useful to build more feature
* for the ES|QL language
*/
export type {
ValidationErrors,
ESQLVariable,
ESQLRealField,
ESQLPolicy,
ErrorTypes as ESQLValidationErrorTypes,
} from './src/validation/types';
export { collectVariables } from './src/shared/variables';
export {
getAllFunctions,
isSupportedFunction,
getFunctionDefinition,
getCommandDefinition,
getAllCommands,
getCommandOption,
getColumnForASTNode as lookupColumn,
shouldBeQuotedText,
printFunctionSignature,
checkFunctionArgMatchesDefinition as isEqualType,
isSourceItem,
isSettingItem,
isFunctionItem,
isOptionItem,
isColumnItem,
isLiteralItem,
isTimeIntervalItem,
isAssignment,
isExpression,
isAssignmentComplete,
isSingleItem,
} from './src/shared/helpers';
export { ENRICH_MODES } from './src/definitions/settings';
export { getFunctionSignatures } from './src/definitions/helpers';
export {
getFieldsByTypeHelper,
getPolicyHelper,
getSourcesHelper,
} from './src/shared/resources_helpers';
export { wrapAsEditorMessage } from './src/code_actions/utils';