@@ -43,6 +43,11 @@ export type Suggestion =
43
43
displayText ?: string ;
44
44
type : 'attribute' ;
45
45
attributeName ?: string ;
46
+ }
47
+ | {
48
+ text : string ;
49
+ displayText ?: string ;
50
+ type : 'traversal' ;
46
51
} ;
47
52
48
53
type TextCallback = ( value : string ) => string ;
@@ -238,6 +243,7 @@ export class SelectionAutoCompleteVisitor
238
243
text : textCallback ( substringMatchText ) ,
239
244
displayText : substringMatchDisplayText ,
240
245
type : 'attribute' as const ,
246
+ attributeName : `${ this . nameBase } _substring` ,
241
247
} ) ;
242
248
}
243
249
this . addAttributeResults ( value , textCallback ) ;
@@ -268,13 +274,13 @@ export class SelectionAutoCompleteVisitor
268
274
this . list . push ( {
269
275
text : textCallback ( '+' ) ,
270
276
displayText : '+' ,
271
- type : 'logical_operator ' as const ,
277
+ type : 'traversal ' as const ,
272
278
} ) ;
273
279
}
274
280
this . list . push ( {
275
281
text : textCallback ( '()' ) ,
276
282
displayText : '(' ,
277
- type : 'function ' as const ,
283
+ type : 'parenthesis ' as const ,
278
284
} ) ;
279
285
}
280
286
}
@@ -313,7 +319,7 @@ export class SelectionAutoCompleteVisitor
313
319
) ;
314
320
315
321
if ( ! options . excludePlus ) {
316
- this . list . push ( { text : '+' , displayText : '+' , type : 'logical_operator ' as const } ) ;
322
+ this . list . push ( { text : '+' , displayText : '+' , type : 'traversal ' as const } ) ;
317
323
}
318
324
319
325
if ( isInsideExpressionlessParenthesizedExpression ( ctx ) ) {
@@ -338,16 +344,16 @@ export class SelectionAutoCompleteVisitor
338
344
339
345
visitUpTraversal ( ctx : UpTraversalContext ) {
340
346
if ( ctx . text . includes ( '+' ) ) {
341
- this . list . push ( { text : '+' , displayText : '+' , type : 'logical_operator ' as const } ) ;
347
+ this . list . push ( { text : '+' , displayText : '+' , type : 'traversal ' as const } ) ;
342
348
}
343
- this . list . push ( { text : '()' , displayText : '(' , type : 'function ' as const } ) ;
349
+ this . list . push ( { text : '()' , displayText : '(' , type : 'parenthesis ' as const } ) ;
344
350
}
345
351
346
352
visitDownTraversal ( ctx : DownTraversalContext ) {
347
353
this . list . push ( { text : ' and ' , displayText : 'and' , type : 'logical_operator' as const } ) ;
348
354
this . list . push ( { text : ' or ' , displayText : 'or' , type : 'logical_operator' as const } ) ;
349
355
if ( ctx . text . includes ( '+' ) ) {
350
- this . list . push ( { text : '+' , displayText : '+' , type : 'logical_operator ' as const } ) ;
356
+ this . list . push ( { text : '+' , displayText : '+' , type : 'traversal ' as const } ) ;
351
357
}
352
358
if ( isInsideExpressionlessParenthesizedExpression ( ctx ) ) {
353
359
this . list . push ( { text : ')' , displayText : ')' , type : 'parenthesis' as const } ) ;
@@ -461,6 +467,7 @@ export class SelectionAutoCompleteVisitor
461
467
}
462
468
this . addUnmatchedValueResults ( '' , DEFAULT_TEXT_CALLBACK , {
463
469
excludeNot : true ,
470
+ excludePlus : true ,
464
471
} ) ;
465
472
}
466
473
@@ -484,7 +491,9 @@ export class SelectionAutoCompleteVisitor
484
491
}
485
492
486
493
visitPostNeighborTraversalWhitespace ( _ctx : PostNeighborTraversalWhitespaceContext ) {
487
- this . addUnmatchedValueResults ( '' , DEFAULT_TEXT_CALLBACK ) ;
494
+ this . addUnmatchedValueResults ( '' , DEFAULT_TEXT_CALLBACK , {
495
+ excludePlus : true ,
496
+ } ) ;
488
497
}
489
498
490
499
visitPostUpwardTraversalWhitespace ( _ctx : PostUpwardTraversalWhitespaceContext ) {
0 commit comments