Skip to content

Commit 7e1f367

Browse files
committed
Add completion implementation.
1 parent a03cb39 commit 7e1f367

28 files changed

+2963
-2309
lines changed

x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.g4

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@ WHERE : 'where' -> pushMode(EXPRESSION_MODE);
8484
// Once the command has been stabilized, remove the DEV_ prefix and the {}? conditional and move the command to the
8585
// main section while preserving alphabetical order:
8686
// MYCOMMAND : 'mycommand' -> ...
87+
DEV_COMPLETION : {this.isDevVersion()}? 'completion' -> pushMode(EXPRESSION_MODE);
8788
DEV_INLINESTATS : {this.isDevVersion()}? 'inlinestats' -> pushMode(EXPRESSION_MODE);
88-
DEV_LOOKUP : {this.isDevVersion()}? 'lookup_🐔' -> pushMode(LOOKUP_MODE);
89+
DEV_LOOKUP : {this.isDevVersion()}? 'lookup_🐔' -> pushMode(LOOKUP_MODE);
8990
DEV_METRICS : {this.isDevVersion()}? 'metrics' -> pushMode(METRICS_MODE);
90-
DEV_RERANK : {this.isDevVersion()}? 'rerank' -> pushMode(EXPRESSION_MODE);
91+
DEV_RERANK : {this.isDevVersion()}? 'rerank' -> pushMode(EXPRESSION_MODE);
9192
// list of all JOIN commands
9293
DEV_JOIN : {this.isDevVersion()}? 'join' -> pushMode(JOIN_MODE);
9394
DEV_JOIN_FULL : {this.isDevVersion()}? 'full' -> pushMode(JOIN_MODE);
@@ -179,6 +180,7 @@ DECIMAL_LITERAL
179180
BY : 'by';
180181
ON: 'on';
181182
WITH: 'with';
183+
AS: 'as';
182184

183185
AND : 'and';
184186
ASC : 'asc';
@@ -355,7 +357,7 @@ RENAME_DOT: DOT -> type(DOT);
355357
RENAME_PARAM : {this.isDevVersion()}? PARAM -> type(PARAM);
356358
RENAME_NAMED_OR_POSITIONAL_PARAM : {this.isDevVersion()}? NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
357359
358-
AS : 'as';
360+
RENAME_AS : AS -> type(AS);
359361
360362
RENAME_ID_PATTERN
361363
: ID_PATTERN -> type(ID_PATTERN)

x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.tokens

Lines changed: 160 additions & 159 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ processingCommand
5252
| enrichCommand
5353
| mvExpandCommand
5454
// in development
55+
| {this.isDevVersion()}? completionCommand
5556
| {this.isDevVersion()}? inlinestatsCommand
5657
| {this.isDevVersion()}? lookupCommand
5758
| {this.isDevVersion()}? joinCommand
@@ -330,9 +331,12 @@ inlinestatsCommand
330331
;
331332

332333
rerankCommand
333-
: DEV_RERANK queryText=stringOrParameter ON input=primaryExpression WITH inferenceId=stringOrParameter
334+
: DEV_RERANK queryText=stringOrParameter ON fields WITH inferenceId=stringOrParameter
334335
;
335336

337+
completionCommand
338+
: DEV_COMPLETION prompt=primaryExpression WITH inferenceId=stringOrParameter (AS target=qualifiedName)?
339+
;
336340

337341
joinCommand
338342
: type=(DEV_JOIN_LOOKUP | DEV_JOIN_LEFT | DEV_JOIN_RIGHT)? DEV_JOIN joinTarget joinCondition

0 commit comments

Comments
 (0)