[8.16] [ES|QL] remove signatures from function suggestion labels (#197842) (#198032)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[ES|QL] remove signatures from function suggestion labels
(#197842)](https://github.com/elastic/kibana/pull/197842)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Drew
Tate","email":"drew.tate@elastic.co"},"sourceCommit":{"committedDate":"2024-10-28T15:41:01Z","message":"[ES|QL]
remove signatures from function suggestion labels (#197842)\n\n##
Summary\r\n\r\nShowing a single acceptable function signature in the
suggestions list\r\nis confusing since it may imply that other options
are not accepted.\r\nInstead, this PR follows the Typescript tooling and
simply shows the\r\nfunction name in the list.\r\n\r\n![Screenshot
2024-10-25 at 8
17\r\n38 AM](https://github.com/user-attachments/assets/9caf4998-b144-45d4-8a53-b41846714d5b)\r\n\r\nThe
signatures are still available in the details flyout.\r\n\r\n\r\n<img
width=\"981\" alt=\"Screenshot 2024-10-25 at 8 50
01 AM\"\r\nsrc=\"https://github.com/user-attachments/assets/17ca7b55-9c88-4a42-91e0-762cfc4809b5\">\r\n\r\n\r\n\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Stratoula Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"88a86b29b82e13a065744859ee3c1540a01657e1","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Feature:ES|QL","Team:ESQL","v8.16.0","backport:version","v8.17.0"],"title":"[ES|QL]
remove signatures from function suggestion
labels","number":197842,"url":"https://github.com/elastic/kibana/pull/197842","mergeCommit":{"message":"[ES|QL]
remove signatures from function suggestion labels (#197842)\n\n##
Summary\r\n\r\nShowing a single acceptable function signature in the
suggestions list\r\nis confusing since it may imply that other options
are not accepted.\r\nInstead, this PR follows the Typescript tooling and
simply shows the\r\nfunction name in the list.\r\n\r\n![Screenshot
2024-10-25 at 8
17\r\n38 AM](https://github.com/user-attachments/assets/9caf4998-b144-45d4-8a53-b41846714d5b)\r\n\r\nThe
signatures are still available in the details flyout.\r\n\r\n\r\n<img
width=\"981\" alt=\"Screenshot 2024-10-25 at 8 50
01 AM\"\r\nsrc=\"https://github.com/user-attachments/assets/17ca7b55-9c88-4a42-91e0-762cfc4809b5\">\r\n\r\n\r\n\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Stratoula Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"88a86b29b82e13a065744859ee3c1540a01657e1"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197842","number":197842,"mergeCommit":{"message":"[ES|QL]
remove signatures from function suggestion labels (#197842)\n\n##
Summary\r\n\r\nShowing a single acceptable function signature in the
suggestions list\r\nis confusing since it may imply that other options
are not accepted.\r\nInstead, this PR follows the Typescript tooling and
simply shows the\r\nfunction name in the list.\r\n\r\n![Screenshot
2024-10-25 at 8
17\r\n38 AM](https://github.com/user-attachments/assets/9caf4998-b144-45d4-8a53-b41846714d5b)\r\n\r\nThe
signatures are still available in the details flyout.\r\n\r\n\r\n<img
width=\"981\" alt=\"Screenshot 2024-10-25 at 8 50
01 AM\"\r\nsrc=\"https://github.com/user-attachments/assets/17ca7b55-9c88-4a42-91e0-762cfc4809b5\">\r\n\r\n\r\n\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Stratoula Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"88a86b29b82e13a065744859ee3c1540a01657e1"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Drew Tate <drew.tate@elastic.co>
This commit is contained in:
Kibana Machine 2024-10-29 04:31:03 +11:00 committed by GitHub
parent f5e7c9b963
commit ac44c8bbca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 9 deletions

View file

@ -18,7 +18,6 @@ import * as autocomplete from '../autocomplete';
import type { ESQLCallbacks } from '../../shared/types';
import type { EditorContext, SuggestionRawDefinition } from '../types';
import { TIME_SYSTEM_PARAMS, TRIGGER_SUGGESTION_COMMAND, getSafeInsertText } from '../factories';
import { getFunctionSignatures } from '../../definitions/helpers';
import { ESQLRealField } from '../../validation/types';
import {
FieldType,
@ -214,13 +213,9 @@ export function getFunctionSignaturesByReturnType(
label: name.toUpperCase(),
};
}
const printedSignatures = getFunctionSignatures(definition, {
withTypes: true,
capitalize: true,
});
return {
text: `${name.toUpperCase()}($0)`,
label: printedSignatures[0].declaration,
label: name.toUpperCase(),
};
});
}

View file

@ -64,7 +64,7 @@ function getSafeInsertSourceText(text: string) {
export function getSuggestionFunctionDefinition(fn: FunctionDefinition): SuggestionRawDefinition {
const fullSignatures = getFunctionSignatures(fn, { capitalize: true, withTypes: true });
return {
label: fullSignatures[0].declaration,
label: fn.name.toUpperCase(),
text: `${fn.name.toUpperCase()}($0)`,
asSnippet: true,
kind: 'Function',

View file

@ -9976,7 +9976,7 @@
{
"query": "from index [METADATA _id, _source2]",
"error": [
"Metadata field [_source2] is not available. Available metadata fields are: [_version, _id, _index, _source, _ignored]"
"Metadata field [_source2] is not available. Available metadata fields are: [_version, _id, _index, _source, _ignored, _index_mode]"
],
"warning": [
"Square brackets '[]' need to be removed from FROM METADATA declaration"
@ -10014,7 +10014,7 @@
{
"query": "from index METADATA _id, _source2",
"error": [
"Metadata field [_source2] is not available. Available metadata fields are: [_version, _id, _index, _source, _ignored]"
"Metadata field [_source2] is not available. Available metadata fields are: [_version, _id, _index, _source, _ignored, _index_mode]"
],
"warning": []
},