Skip to content

Commit 64840f2

Browse files
authored
[ES|QL] Reorder from suggestions (#241281)
## Summary Now after an index pattern we display: * Pipe * Comma * METADATA * Suggested querys ![from](https://github.com/user-attachments/assets/ade556a0-f584-4f85-8cc1-f07069743e28)
1 parent 9686335 commit 64840f2

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/platform/packages/shared/kbn-esql-ast/src/commands_registry/commands/from/autocomplete.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ export async function autocomplete(
5555
}
5656
// FROM something /
5757
else if (indexes.length > 0 && /\s$/.test(innerText) && !isRestartingExpression(innerText)) {
58-
suggestions.push(metadataSuggestion);
58+
suggestions.push({ ...pipeCompleteItem, sortText: '0' });
5959
suggestions.push(commaCompleteItem);
60-
suggestions.push(pipeCompleteItem);
60+
suggestions.push(metadataSuggestion);
61+
6162
suggestions.push(
6263
...(await getRecommendedQueriesSuggestions(
6364
context?.editorExtensions ?? { recommendedFields: [], recommendedQueries: [] },

src/platform/packages/shared/kbn-esql-ast/src/commands_registry/options/metadata/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const metadataSuggestion: ISuggestionItem = withAutoSuggest({
3232
detail: i18n.translate('kbn-esql-ast.esql.definitions.metadataDoc', {
3333
defaultMessage: 'Metadata',
3434
}),
35-
sortText: '1',
35+
sortText: 'C',
3636
});
3737

3838
export const getMetadataSuggestions = (command: ESQLAstAllCommands, queryText: string) => {

src/platform/packages/shared/kbn-esql-ast/src/definitions/utils/sources.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export async function additionalSourcesSuggestions(
181181
filterText: fragment,
182182
text: fragment + ' | ',
183183
rangeToReplace,
184+
sortText: '0',
184185
}),
185186
withAutoSuggest({
186187
...commaCompleteItem,

0 commit comments

Comments
 (0)