Closed debashish2014 closed 6 years ago
I think the problem is with the input: unless you have a space at the end of the input, the autosuggest engine has no way of knowing that you finished typing the identifier name and are about to start writing a new token.
If you add a trailing space after SELECT EMPLOYEE
before calling the autosuggester, it does suggest FOR
and WHERE
.
@debashish2014 do you agree or did I miss something?
Hi @oranoran, you are right. I missed adding the trailing space. It works perfectly fine. Sorry for the trouble.
Hi @oranoran,
I am using the below grammar file for testing. If user types 'SHOW EMPLOYEE' or 'SELECT EMPLOYEE' then the suggestion should be 'FOR' and 'WHERE', however, it is coming as empty at the moment.
grammar autocomplete;
query : query_stmt EOF ;
query_stmt : start_keyword literal_name filter_name ;
filter_name : 'FOR' | 'WHERE' ;
start_keyword : 'SHOW' | 'SELECT' ;
literal_name : IDENTIFIER ;
IDENTIFIER: LETTER (LETTER | [0-9])*;
SPACES : [ \u000B\t\r\n] -> channel(HIDDEN) ;
UNEXPECTED_CHAR : . ;
fragment DIGIT : [0-9];
fragment LETTER : [a-zA-Z] ;